Modify scoring algorithm for fuzzy search (#2361)

* Modify scoring

* modified to if else
This commit is contained in:
Alekhya
2020-04-23 15:39:55 -07:00
committed by GitHub
parent 8b10fe4053
commit 46d1bc274c

View File

@@ -212,8 +212,15 @@ namespace Wox.Infrastructure
if (allSubstringsContainedInCompareString)
{
int count = query.Count(c => !char.IsWhiteSpace(c));
int factor = count < 4 ? 10 : 5;
score += factor * count;
int threshold = 4;
if(count <= threshold)
{
score += count * 10;
}
else
{
score += threshold * 10 + (count - threshold) * 5;
}
}
return score;