Not so much a bug, as a consequence of how indexing works. Value queries, even 
exact values queries are word searches with a spanning constraint. If you 
really want an equality search, set up a range index and do a range query.

What is going on is that the index key for "new" (value exact) is same as the 
key for "NEW" (case-insensitive word) and as an unfiltered index resolution, 
the two cases cannot be distinguished without filtering. The flags are not 
baked into the lookup keys (if they were, index sixes would be much much 
larger). Phrases (in whitespace-separated languages) don't have this same issue 
because a word key cannot include the space between words, so an exact value 
query for "new status" will not match "New status"

//Mary

On 03/23/2017 12:40 AM, Andreas Hubmer wrote:
Hi,

There seems to be a bug related to unfiltered and exact value searches.

We are using value queries in the Java API, but I've boiled it down to cts 
searches.
The following snippet exhibits the wrong behavior:

xquery version "1.0-ml";
xdmp:document-insert("/bug/doc.xml", <status>NEW</status>)
;

"Document is found: OK",
cts:search(/,
  cts:and-query((cts:directory-query("/bug/", "infinity"), 
cts:element-value-query(xs:QName("status"), "NEW", ("exact")))),
  "unfiltered"
)

,"---",
"Document is not found: OK",
cts:search(/,
  cts:and-query((cts:directory-query("/bug/", "infinity"), 
cts:element-value-query(xs:QName("status"), "NEw", ("exact")))),
  "unfiltered"
)

,"---",
"Document is found: WRONG",
cts:search(/,
  cts:and-query((cts:directory-query("/bug/", "infinity"), 
cts:element-value-query(xs:QName("status"), "new", ("exact")))),
  "unfiltered"
)

We are using a database with fast-case-sensitive-searches and 
fast-diacritic-sensitive-searches turned on, while all other indexes are turned 
off.
As far as I know only the two indexes are needed for unfiltered exact value 
searches.

Regards,
Andreas



_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to