0

I am looking for date range query in QBE. I am trying below query sample

https://Server:port/v1/qbe?format=json&pageLength=10&start=1&directory=/json/&options=search_option_advanced_date&query={"$query":{
"$and":[{"creation_date":{"$le":"2018-12-12T05:40:47.496"}},{"creation_date":{"$ge":"2017-12-12T05:40:47.496"}}],"$filtered":true}}

here i have created path range index on '/Creation_Date_date' & element range index on 'Creation_Date_date' also added below constraint in search_option_advanced_date file in persistent options

<constraint name="creation_date">
   <range type="xs:date">
     <element name="Creation_Date_date"/>
   </range>
 </constraint>

Though the results should get fetched i am getting below blanks

{
  "snippet-format":"snippet", 
  "total":0, 
  "start":1, 
  "page-length": 10, 
  "selected": "include-with-ancestors", 
  "results":[], 
  "facets": {
    "EntityType":{"type":"xs:string", "facetValues":[]}, 
    "Category":{"type":"xs:string", "facetValues":[]}, 
    "Genre":{"type":"xs:string", "facetValues":[]}, 
    "creation_date":{"type":"xs:date", "facetValues":[]}
  }, 
  "metrics": {
    "query-resolution-time":"PT0.016599S", 
   "facet-resolution-time":"PT0.000578S", 
   "extract-resolution-time":null, "total-time":"PT0.017743S"
  }
}
Wagner Michael
  • 2,172
  • 1
  • 15
  • 29
PALLAVI
  • 21
  • 7

1 Answers1

1

To use persistent query options, the QBE query must use the constraint property to specify the query options:

http://docs.marklogic.com/guide/search-dev/qbe#id_32338

That said, if you're using query options, it's usually more straightforward to use a combined query:

http://docs.marklogic.com/guide/rest-dev/search#id_69918

Finally, the constraint is typed as a xs:date value but the query supplies xs:dateTime values.

Hoping that helps,

ehennum
  • 7,295
  • 13
  • 9