Reputation: 700
According to the MarkLogic docs, the "collection" parameter can appear multiple times in a GET request to the REST Client API; however, the following returns 0 results:
/LATEST/search?q=&collection=GEWN&collection=TSJN
whereas an XQuery specifying both collections on the same database does return the expected results:
count(collection(("GEWN","TSJN")))
=> 90871
Using REST API to query one named collection individually returns expected results also.
Thanks.
Upvotes: 0
Views: 305
Reputation: 7335
The collections provided by URI parameter are AND related. The equivalent provided as a query would be:
<search:query>
<search:and-query>
<search:collection-query>
<search:uri>GEWN</search:uri>
</search:collection-query>
<search:collection-query>
<search:uri>TSJN</search:uri>
</search:collection-query>
</search:and-query>
</search:query>
When multiple collections are passed to a single fn:collection()
or cts:collection-query()
call, the collections are OR related. To get the equivalent, provide the following query:
<search:query>
<search:collection-query>
<search:uri>GEWN</search:uri>
<search:uri>TSJN</search:uri>
</search:collection-query>
</search:query>
Here's the reference for the collection query in JSON:
http://docs.marklogic.com/guide/search-dev/structured-query#id_76890
Hoping that helps,
Upvotes: 2