简体   繁体   English

在QBE中创建日期范围查询格式示例时需要帮助(通过示例查询)MarkLogic

[英]Need help in creating date range query format sample in QBE(Query by Example) MarkLogic

I am looking for date range query in QBE. 我正在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 在这里,我在'/ Creation_Date_date'上创建了路径范围索引,并在'Creation_Date_date'上创建了元素范围索引,并在持久选项中的search_option_advanced_date文件中添加了以下约束

<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"
  }
}

To use persistent query options, the QBE query must use the constraint property to specify the query options: 要使用持久查询选项,QBE查询必须使用约束属性来指定查询选项:

http://docs.marklogic.com/guide/search-dev/qbe#id_32338 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 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. 最后,将约束键入为xs:date值,但查询提供xs:dateTime值。

Hoping that helps, 希望能有所帮助,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM