marklogic-community/Corona

Unable to search on dateTime range index

stoussaint opened this issue · 3 comments

I'm just giving a try to Corona and gone to the search rest API.
I'm able to do a lot of thing but unable to query a dateTime index with something like :

http://localhost:8004/search?outputFormat=xml&structuredQuery=date-submitted2011-11-22T17:30:002011-11-22T17:35:00

  • The manage/ranges return : [{"":"date-submitted","":"dc:dateSubmitted","":"dateTime"}]
  • The manage/namespaces return : [{"":"dc","":"http://purl.org/dc/elements/1.1/"}]
  • I have an element range index set in marklogic for {http://purl.org/dc/elements/1.1/}dateSubmitted with dateTime type

The result is an error : No string element range index for xs:QName("dc:dateSubmitted") http://marklogic.com/collation/ which I could understand because indeed I have no string range index for this element/

The underlying cts query is :
cts:search(fn:doc(), cts:and-query(( cts:element-range-query(xs:QName("dc:dateSubmitted"), ">=", "2011-11-22T17:30:00", ("collation=http://marklogic.com/collation/"), 1), cts:element-range-query(xs:QName("dc:dateSubmitted"), "<=", "2011-11-22T17:35:00", ("collation=http://marklogic.com/collation/"), 1)), ()), "unfiltered")

While I'm waiting something like
cts:search(fn:doc(), cts:and-query(( cts:element-range-query(xs:QName("dc:dateSubmitted"), ">=", xs:dateTime("2011-11-22T17:30:00")), cts:element-range-query(xs:QName("dc:dateSubmitted"), "<=", xs:dateTime("2011-11-22T17:35:00"))), ()), "unfiltered")

What am I doing wrong ?

Looks like you're not actually doing anything wrong. I wasn't properly detecting the datatype for XML element and attribute range indexes. The fix is in place now so pull down the changes when you get a chance and let me know if it solves your problem.

By the way, thank you for the fantastic bug report.

Just try your fix and it works like a charm, great !!!

Thank you for your quick reply

Excellent.

Let us know if you run into any other issues, have any questions or could use a feature.