mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
Modify scoring algorithm for fuzzy search (#2361)
* Modify scoring * modified to if else
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user