Skip to content

Commit 5011246

Browse files
committed
Add scoring to ContextMenu search
1 parent 1071f75 commit 5011246

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,20 @@ private void QueryContextMenu()
354354
{
355355
var filtered = results.Where
356356
(
357-
r => StringMatcher.FuzzySearch(query, r.Title).IsSearchPrecisionScoreMet()
358-
|| StringMatcher.FuzzySearch(query, r.SubTitle).IsSearchPrecisionScoreMet()
359-
).ToList();
357+
r =>
358+
{
359+
var match = StringMatcher.FuzzySearch(query, r.Title);
360+
if (!match.IsSearchPrecisionScoreMet())
361+
{
362+
match = StringMatcher.FuzzySearch(query, r.SubTitle);
363+
}
364+
365+
if (!match.IsSearchPrecisionScoreMet()) return false;
366+
367+
r.Score = match.Score;
368+
return true;
369+
370+
}).ToList();
360371
ContextMenu.AddResults(filtered, id);
361372
}
362373
else

0 commit comments

Comments
 (0)