I noticed a cts:query not doing what I expected. To track down the
problem, I simplified it to the most minimal form that still exhibits
the problem. While experimenting with the query, I found two
nearly-identical queries that together appear to contradict a simple
logical property...
There is a certain document in my database that satisfies the following query:
=======
let $d := cts:search( doc(),
cts:and-query(
cts:element-query(fn:QName("my-ns", "Encounter"),
cts:and-query((
cts:element-range-query(fn:QName("my-ns",
"AdmissionDate"), ">=", xs:dateTime("2008-10-14T10:43:00"), (), 1),
cts:element-range-query(fn:QName("my-ns",
"DischargeDate"), "=", xs:dateTime("2008-10-17T10:43:00"), (), 1)
))))
)
return for $i in $d
return $i
=======
...but if I change only the operator in the second line of the nested
and-query as follows:
=======
cts:element-range-query(fn:QName("my-ns", "DischargeDate"), "<=",
xs:dateTime("2008-10-17T10:43:00"), (), 1)
=======
...there are no results.
So nothing changed except that instead of requiring that DischargeDate
be EQUAL TO a certain date, I require that it be LESS THAN OR EQUAL TO
that same date. In the first case, the document is matched, but not
in the second case.
Note that I have a dateTime range index on DischargeDate (obviously,
or I'd get an exception in either case). The document has
DischargeDate equal to the date I am using here, so <=, =, and >=
operators should all result in a match.
What's going on? I don't often entertain the idea that there may be a
bug in MarkLogic, but this one makes me wonder.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general