Reputation:
How can I fix the following code, if I would like to specify multiple collections? (like 'pdf' AND 'systemA')
for $doc in fn:collection("pdf")
Upvotes: 1
Views: 346
Reputation: 4912
If you want to get documents that are in either the "A"
or "B"
collections. in MarkLogic you can pass multiple URIs: fn:collection(("A","B"))
. If you want documents that are in both the "A"
and "B"
collections simultaneously, you'll either have to do this as a search
cts:search(doc(),
cts:and-query((cts:collection-query("A"),cts:collection-query("B")),"unfiltered")
or do the set intersection manually
let $as := fn:collection("A")
return fn:collection("B")[not(. is $as)]
The search would be more efficient, since it can use indexes to resolve.
Upvotes: 6