Having a little trouble setting up a field constraint in the Search API and
can’t find an answer in the documentation.
We’ve created a field called “anywhere” composed of a number of elements that
appear in our standard XML document.
We’ve also created a constraint called ANY defined as:
<constraint name=“ANY”>
<word>
<field name=“anywhere” />
</word>
</constraint>
We are sending the string ANY:(x y) to the search API. We are looking for this
to turn into two AND’d word queries but what we get is a phrase search on “x y”.
Here’s the output from the search API:
<search:report id="SEARCH-FLWOR">
(cts:search(/book, cts:field-word-query("anywhere", "x y", ("lang=en"), 1),
("score-logtfidf",cts:score-order("descending")), 1))[1 to 20]
</search:report>
We were hoping instead for something like this.
<search:report id="SEARCH-FLWOR">
(cts:search(/book, cts:field-word-query(“anywhere"),
cts:and-query((cts:word-query("x",
("case-insensitive","diacritic-insensitive","punctuation-insensitive","wildcarded","lang=en"),
1), cts:word-query("y",
("case-insensitive","diacritic-insensitive","punctuation-insensitive","wildcarded","lang=en"),
1)), ()), ()), ("score-logtfidf",cts:score-order("descending")), 1))[1 to 20]
</search:report>
Is this kind of search possible with fields? If so, how should the constraint
be defined?
Thanks in advance,
Alan
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general