logic: Fixed search autocompletion scoring to not give last letter bonus

This commit is contained in:
Eberhard Graether
2016-12-01 14:43:44 +01:00
parent 6e0eb89cd0
commit 3ab86c2e4f
+1 -3
View File
@@ -417,15 +417,13 @@ int SearchIndex::scoreText(const std::string& text, const std::vector<size_t>& i
else if (isupper(text[index])) else if (isupper(text[index]))
{ {
bool prevIsLower = (index > 0 && islower(text[index - 1])); 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) if (prevIsLower || nextIsLower)
{ {
camelCaseScore += camelCaseBonus; camelCaseScore += camelCaseBonus;
} }
} }
} }
int leadingStartScore = std::max(int(indices[0]) * delayedStartBonus, minDelayedStartBonus); int leadingStartScore = std::max(int(indices[0]) * delayedStartBonus, minDelayedStartBonus);