logic: fixed underflow in fuzzy search after 100 chars

This commit is contained in:
Eberhard Graether
2015-03-09 15:01:54 +01:00
parent ca9dfe7f75
commit 299cb49540
3 changed files with 31 additions and 31 deletions
+2 -2
View File
@@ -348,10 +348,10 @@ std::pair<size_t, size_t> SearchNode::fuzzyMatch(
char c = m_name[i];
if (tolower(query[pos]) == tolower(c))
{
weight += std::max<size_t>(100 - size - i, 1);
weight += std::max<size_t>(100 / sqrt(size + i + 1), 1);
if (matchCount)
{
weight += matchCount * 10;
weight += matchCount * matchCount * 10;
}
else if (i == 0 || lastChar == '_' || tolower(c) != c)
{