I just wanted to create a unfiltered whitespace-sensitive
cts query and somehow can not get it working (without other constraints).
This is my testing environment:
xquery version "1.0-ml";
xdmp:document-insert("test1.xml", <test><title>test word</title></test>);
xdmp:document-insert("test2.xml", <test><title>test-word</title></test>);
cts:search(//test, cts:element-value-query(xs:QName("title"), "test word", ("whitespace-sensitive")), ("unfiltered"))
I have two documents which only differ in a single character -
. Executing this cts search returns both documents. Looking at the execution-plan things get strange. The final-plan shows this:
<qry:term-query weight="1">
<qry:key>5029803220044614354</qry:key>
<qry:annotation>element(title,value("test","word"))</qry:annotation>
</qry:term-query>
MarkLogic seems to search for the two words test
and word
without a whitespace. It does not seem to use the option whitespace-sensitive
. Only if I add three more options "case-sensitive", "diacritic-sensitive" and "punctuation-sensitive" it does the actual whitespace-sensitive search. Removing any of the options results in a whitespace-insensitive search:
xdmp:plan(cts:search(//test, cts:element-value-query(xs:QName("title"), "test word", ("case-sensitive", "diacritic-sensitive", "punctuation-sensitive", "whitespace-sensitive")), ("unfiltered")))
=> ...
<qry:term-query weight="1">
<qry:key>11298961959398038325</qry:key>
<qry:annotation>element(title,value("test"," ","word"))</qry:annotation>
</qry:term-query>
Am I misunderstanding the option "whitespace-sensitive"?
Using MarkLogic 9.8-0.