Я настроил и проиндексировал полученную дату. Похоже, что в моей базе данных получена дата: «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"
}
]
}
...