logic: Fixed sorting of search results and crash in undo redo controller

This commit is contained in:
Eberhard Graether
2016-04-19 12:38:03 +02:00
parent 7cd38f8e56
commit 5d71536bb1
2 changed files with 8 additions and 3 deletions
+3 -3
View File
@@ -220,8 +220,8 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
const size_t maxResultCount = 100;
std::vector<SearchResult> elementResults = m_elementIndex.search(query, maxResultCount);
std::sort(elementResults.begin(), elementResults.end(), [](
SearchResult a,
SearchResult b)
const SearchResult& a,
const SearchResult& b)
{
// should a be ranked higher than b?
if (a.score > b.score)
@@ -240,7 +240,7 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
// move uppercase letters to higher ascii range
std::string sA = utility::switchCases(a.text);
std::string sB = utility::switchCases(b.text);
return (sA.compare(sB) <= 0);
return (sA.compare(sB) < 0);
}
}
return false;