Reputation: 83
I am using Marklogic8
, and based on a business rule, I write JSON to two different URIs, uriA and uriB.
The use case is the files can contain same elements and same values eg: a timestamp
.
When I search based on the timestamp, I need files from only one URI say uriB.
How do I get that?
Upvotes: 2
Views: 163
Reputation: 11771
If you know the URI ahead of time, then you can simply AND your query with a cts:document-query
:
cts:and-query((
cts:json-property-query('timestamp', $myTimestamp), (: Or however you query timestamps :)
cts:document-query('uriB')
))
Update:
Using Java API you could build a similar query:
StructuredQueryBuilder sb = ...
StructuredQueryDefinition sq =
sb.and(
sb.document("uriB"),
sb.containerQuery(sb.jsonProperty("timestamp"), myTimestamp));
Upvotes: 3