Skip to content

Commit c4b81a9

Browse files
committed
change query translation to Program.Main instead of using Alphabet.Tranlate to avoid cache.
1 parent d17621c commit c4b81a9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Flow.Launcher.Infrastructure/StringMatcher.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
5050

5151
if (_alphabet != null)
5252
{
53-
query = _alphabet.Translate(query);
5453
stringToCompare = _alphabet.Translate(stringToCompare);
5554
}
5655

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Flow.Launcher.Infrastructure.Storage;
99
using Flow.Launcher.Plugin.Program.Programs;
1010
using Flow.Launcher.Plugin.Program.Views;
11+
using ToolGood.Words.Pinyin;
1112
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
1213

1314
namespace Flow.Launcher.Plugin.Program
@@ -77,13 +78,15 @@ public List<Result> Query(Query query)
7778
uwps = _uwps;
7879
}
7980

81+
var searchText = WordsHelper.HasChinese(query.Search) ? WordsHelper.GetPinyin(query.Search) : query.Search;
82+
8083
var results1 = win32.AsParallel()
8184
.Where(p => p.Enabled)
82-
.Select(p => p.Result(query.Search, _context.API));
85+
.Select(p => p.Result(searchText, _context.API));
8386

8487
var results2 = uwps.AsParallel()
8588
.Where(p => p.Enabled)
86-
.Select(p => p.Result(query.Search, _context.API));
89+
.Select(p => p.Result(searchText, _context.API));
8790

8891
var result = results1.Concat(results2).Where(r => r != null && r.Score > 0).ToList();
8992
return result;

0 commit comments

Comments
 (0)