How to perform a MarkLogic search for documents in one or more collections -


i have documents in collections based upon mime-type image it's describing: image/jpg, image/png, image/gif.

i able specify $mime-type "image" or "image/jpg" can search document across image types or across specific subtype.

let $mime-type-pattern := fn:concat($mime-type, "*") let $mime-type-collection-uris := cts:collection-match($mime-type-pattern) 

searching $mime-type "image" return uris ("image/jpg", "image/png", "image/gif"). able search documents in of these collections.

searching $mime-type "image/jpg" return uri ("image/jpg"). searching documents "image/jpg" collection.

what structure of search:options need create search search api?

you use cts:collection-query inside <additional-query> option nested inside <options> node:

search:search("foo",   <options xmlns="http://marklogic.com/appservices/search">     <additional-query>       {cts:collection-query($mime-type-collection-uris)}     </additional-query>   </options>) 

this constrain search collections in $mime-type-collection-uris.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -