1

我已经配置并索引了接收日期。在我的数据库中看起来像 receivedDate:"2019-02-130 01:01:01 PM"。如何使用日期类型文本或日期类型实例进行排序?

这是配置的字段(假设没有任何错字以防万一)。

personDoc | only index specified fields
a.  name | text | searchable as nameSort | keyword | index | store
b.  name | text | searchable as nameSearch | OCISSearchAnalyzer | index | include in _all field | include term vectors
c.  receivedDate | datetime | index

我想按名称排序,然后按接收日期排序

new SearchQuery(String indexName, AbstractFtsQuery queryPart).fields("nameSort", "receivedDate").sort("nameSort", "receivedDate");

这是全文索引的样子:

...
"receivedDate": {
  "dynamic": false,
  "enabled": true,
  "fields": [
    {
      "analyzer": "keyword",
      "include_in_all": false,
      "include_term_vectors": true,
      "index": true,
      "name": "receivedDate",
      "store": false,
      "type": "datetime"
    }
  ]
},
"name": {
  "dynamic": false,
  "enabled": true,
  "fields": [
    {
      "analyzer": "keyword",
      "include_in_all": false,
      "include_term_vectors": false,
      "index": true,
      "name": "nameSort",
      "store": true,
      "type": "text"
    },
    {
      "analyzer": "OCISSearchAnalyzer",
      "include_in_all": true,
      "include_term_vectors": true,
      "index": true,
      "name": "nameSearch",
      "store": false,
      "type": "text"
    }
  ]
}
...
4

0 回答 0