Let’s say i have 2 documents:
<doc1>
<a>the dog</a>
<a>the cat</a>
<a>the human</a>
</doc1>
and
<doc2>
<a>the dog</a>
<a>foo</a>
<a>bar</a>
</doc2>
Now for Marklogic, i want to search them for ‘the’ so I might run:
search:search(
'a:the',
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="a">
<value>
<term-option>case-insensitive</term-option>
<element ns="" name="a"/>
</value>
</constraint>
</options>
)
this works, but returns both documents (which is what i asked for)
But what if I wanted only results that had more than 1 match on the constraint…
ie. ‘give me the documents that have 2+ nodes with “the”‘
I have no idea where to start. Thanks!
The answers to your question at http://markmail.org/message/gaehhxnr7qb2un5p#query:+page:1+mid:vxjmjuh2wflofa67+state:results seemed good. Summarizing the thread, Rob and John both pointed out the
min-occursoption forcts:searchand Colleen added:Mary noted that the index lookups would be
Just to clarify: while Colleen mentioned a word constraint, http://docs.marklogic.com/cts:element-value-query shows the same option available for
cts:element-value-query. So you should be able to use it with a value constraint too.