Reputation: 139
I want to understand if marklogic has the ability to compare element values within a single document while performing a search i.e. cts:search.
For eg:
Consider a document as below
<root>
<someTags></someTags>
.
.
.
<effectivePeriod>
<dateTimeBegin>2009-01-16T00:00:00-05:00
</dateTimeBegin>
<dateTimeEnd>2009-01-16T00:00:00-05:00
</dateTimeEnd>
</effectivePeriod>
.
.
.
<otherTags></otherTags>
</root>
Let's imagine that there are a hundred thousand documents like the one above. How can I make a search that ensures I only pick up documents where the effectivePeriod.dateTimeEnd > effectivePeriod.dateTimeBegin?
Upvotes: 2
Views: 123
Reputation: 66714
Construct your cts:search()
with as specific criteria as possible, and then filter the results with a predicate:
cts:search(collection(),
cts:and-query())[root/effectivePeriod[dateTimeEnd gt dateTimeBegin]]
Upvotes: 1