mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Ensure dateCreated property exists at index creation time
Summary: Since the default query will sort on this when no query string is attached we want to make sure the property at least exists. Otherwise Elasticsearch yells at you: "No mapping found for [dateCreated] in order to sort on" when you try to search for documents that haven't been indexed yet. Test Plan: Searched for Mocks and Initiatives (no such documents exist in my index) and got the error. After patching and reinitializing the index, the error during querying went away. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11056
This commit is contained in:
parent
c8d707caa0
commit
9374ace602
1 changed files with 4 additions and 0 deletions
|
@ -275,8 +275,12 @@ final class PhabricatorSearchEngineElastic extends PhabricatorSearchEngine {
|
|||
$types = array_keys(
|
||||
PhabricatorSearchApplicationSearchEngine::getIndexableDocumentTypes());
|
||||
foreach ($types as $type) {
|
||||
// Use the custom trigram analyzer for the corpus of text
|
||||
$data['mappings'][$type]['properties']['field']['properties']['corpus'] =
|
||||
array( 'type' => 'string', 'analyzer' => 'custom_trigrams' );
|
||||
|
||||
// Ensure we have dateCreated since the default query requires it
|
||||
$data['mappings'][$type]['properties']['dateCreated']['type'] = 'string';
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
|
Loading…
Reference in a new issue