marklogic-community / Corona

Community REST API for MarkLogic
Other
37 stars 9 forks source link

Unable to search on dateTime range index #65

Closed stoussaint closed 12 years ago

stoussaint commented 12 years ago

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 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 ?

ryangrimm commented 12 years ago

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.

stoussaint commented 12 years ago

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

Thank you for your quick reply

ryangrimm commented 12 years ago

Excellent.

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