From 46d1bc274c195ca67418c8ecfbaea302e781c066 Mon Sep 17 00:00:00 2001 From: Alekhya Date: Thu, 23 Apr 2020 15:39:55 -0700 Subject: [PATCH] Modify scoring algorithm for fuzzy search (#2361) * Modify scoring * modified to if else --- .../launcher/Wox.Infrastructure/StringMatcher.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs index 442c1e9ddb..ef3e1045b2 100644 --- a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs @@ -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;