logic: fixed: search activates wrong symbol if multiple potential matches share the same "long" symbol name

This commit is contained in:
mlangkabel
2018-11-12 16:31:41 +01:00
parent 6490191972
commit fb95762293
+5 -4
View File
@@ -271,7 +271,7 @@ std::multiset<SearchResult> SearchIndex::createScoredResults(
SearchResult SearchIndex::bestScoredResult(
SearchResult result, std::map<std::wstring, SearchResult>* 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<size_t> indices = result.indices;