mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
calculate score for addtional info
This commit is contained in:
parent
767aaa80a0
commit
870ad008bf
2 changed files with 12 additions and 9 deletions
|
|
@ -87,18 +87,20 @@ namespace Wox.Plugin.ControlPanel
|
|||
|
||||
private int Score(ControlPanelItem item, string query)
|
||||
{
|
||||
var scores = new List<int>();
|
||||
if (item.LocalizedString != null)
|
||||
var scores = new List<int> {0};
|
||||
if (string.IsNullOrEmpty(item.LocalizedString))
|
||||
{
|
||||
var score1 = StringMatcher.Score(item.LocalizedString, query);
|
||||
var socre2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
|
||||
scores.Add(Math.Max(score1, socre2));
|
||||
var score2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
|
||||
scores.Add(score1);
|
||||
scores.Add(score2);
|
||||
}
|
||||
if (item.InfoTip != null)
|
||||
if (!string.IsNullOrEmpty(item.InfoTip))
|
||||
{
|
||||
// todo should we add pinyin score for infotip also?
|
||||
var score = StringMatcher.Score(item.InfoTip, query);
|
||||
scores.Add(score);
|
||||
var score1 = StringMatcher.Score(item.InfoTip, query);
|
||||
var score2 = StringMatcher.ScoreForPinyin(item.InfoTip, query);
|
||||
scores.Add(score1);
|
||||
scores.Add(score2);
|
||||
}
|
||||
return scores.Max();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,8 @@ namespace Wox.Plugin.Program.Programs
|
|||
var score1 = StringMatcher.Score(DisplayName, query);
|
||||
var score2 = StringMatcher.ScoreForPinyin(DisplayName, query);
|
||||
var score3 = StringMatcher.Score(Description, query);
|
||||
var score = new[] { score1, score2, score3 }.Max();
|
||||
var score4= StringMatcher.ScoreForPinyin(Description, query);
|
||||
var score = new[] { score1, score2, score3, score4 }.Max();
|
||||
return score;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue