[MarkLogic Dev General] Bizarre cts:query behavior
karl.erisman at gmail.com
Fri Jan 8 14:30:44 PST 2010
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
There is a certain document in my database that satisfies the following query:
let $d := cts:search( doc(),
"AdmissionDate"), ">=", xs:dateTime("2008-10-14T10:43:00"), (), 1),
"DischargeDate"), "=", xs:dateTime("2008-10-17T10:43:00"), (), 1)
return for $i in $d
...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.
More information about the General