From fb95762293de9d150b42179e064824095dc7d518 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Mon, 12 Nov 2018 16:31:41 +0100 Subject: [PATCH] logic: fixed: search activates wrong symbol if multiple potential matches share the same "long" symbol name --- src/lib/data/search/SearchIndex.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index 390238aa..398ebc0c 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -271,7 +271,7 @@ std::multiset SearchIndex::createScoredResults( SearchResult SearchIndex::bestScoredResult( SearchResult result, std::map* scoresCache, size_t maxBestScoredResultsLength) { - std::wstring text = result.text; + const std::wstring text = result.text; if (maxBestScoredResultsLength && result.text.size() > maxBestScoredResultsLength) { @@ -287,9 +287,10 @@ SearchResult SearchIndex::bestScoredResult( if (it != scoresCache->end()) { // std::cout << "cached: " << it->first << " " << it->second.score << std::endl; - SearchResult result = it->second; - result.text = text; - return result; + SearchResult cachedResult = it->second; + cachedResult.text = text; + cachedResult.elementIds = result.elementIds; + return cachedResult; } const std::vector indices = result.indices;