mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add title & subtitle search
This commit is contained in:
parent
e196d7cfa9
commit
0f279df8d3
1 changed files with 17 additions and 1 deletions
|
|
@ -78,7 +78,23 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
c.Title = command.Name;
|
||||
c.SubTitle = command.Description;
|
||||
|
||||
var score = _context.API.FuzzySearch(query.Search, command.Keyword).Score;
|
||||
// Firstly, we will search the localized title & subtitle
|
||||
var titleMatch = _context.API.FuzzySearch(query.Search, c.Title);
|
||||
var subTitleMatch = _context.API.FuzzySearch(query.Search, c.SubTitle);
|
||||
|
||||
var score = Math.Max(titleMatch.Score, subTitleMatch.Score);
|
||||
if (score > 0)
|
||||
{
|
||||
c.Score = score;
|
||||
|
||||
if (score == titleMatch.Score)
|
||||
c.TitleHighlightData = titleMatch.MatchData;
|
||||
|
||||
results.Add(c);
|
||||
}
|
||||
|
||||
// If no match found, we will search the keyword
|
||||
score = _context.API.FuzzySearch(query.Search, command.Keyword).Score;
|
||||
if (score > 0)
|
||||
{
|
||||
c.Score = score;
|
||||
|
|
|
|||
Loading…
Reference in a new issue