From 3ab86c2e4fb261022fcd68fda1c0b5d3f0625f9f Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 1 Dec 2016 14:43:44 +0100 Subject: [PATCH] logic: Fixed search autocompletion scoring to not give last letter bonus --- src/lib/data/search/SearchIndex.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index 44813a2c..4194ba75 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -417,15 +417,13 @@ int SearchIndex::scoreText(const std::string& text, const std::vector& i else if (isupper(text[index])) { bool prevIsLower = (index > 0 && islower(text[index - 1])); - bool nextIsLower = (index + 1 == text.size() || islower(text[index + 1])); + bool nextIsLower = (index + 1 < text.size() && islower(text[index + 1])); if (prevIsLower || nextIsLower) { camelCaseScore += camelCaseBonus; } } - - } int leadingStartScore = std::max(int(indices[0]) * delayedStartBonus, minDelayedStartBonus);