logic: Fixed issues in search

* fixed bad search performance when rescoring
* fixed commands had no text in autocompletions
* no autocompletions when entering fulltext search query
* check query actuality before processing autocompletions
This commit is contained in:
Eberhard Graether
2016-11-15 08:12:14 -08:00
parent 96ee2b997c
commit a35e8a53de
10 changed files with 38 additions and 5 deletions
+7 -2
View File
@@ -503,9 +503,11 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionMatches(const std::
// search in indices
size_t maxResultsCount = 100;
size_t maxBestScoredResultsLength = 100;
std::vector<SearchResult> results;
utility::append(results, m_commandIndex.search(query, 0));
utility::append(results, m_elementIndex.search(query, maxResultsCount, 100));
utility::append(results, m_elementIndex.search(query, maxResultsCount, maxBestScoredResultsLength));
utility::append(results, m_fileIndex.search(query, 20));
// fetch StorageNodes for node ids
@@ -556,6 +558,7 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionMatches(const std::
}
match.name = result.text;
match.text = result.text;
match.indices = result.indices;
match.score = result.score;
@@ -585,7 +588,9 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionMatches(const std::
// rescore match
if (idx && match.indices.size())
{
SearchResult newResult = SearchIndex::rescoreText(match.name, match.text, match.indices, match.score);
SearchResult newResult =
SearchIndex::rescoreText(match.name, match.text, match.indices, match.score, maxBestScoredResultsLength);
match.score = newResult.score;
match.indices = newResult.indices;
}