File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
Plugins/Flow.Launcher.Plugin.Sys Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -78,26 +78,23 @@ public List<Result> Query(Query query)
78
78
c . Title = command . Name ;
79
79
c . SubTitle = command . Description ;
80
80
81
- // Firstly, we will search the localized title & subtitle
81
+ // Match from localized title & localized subtitle & keyword
82
82
var titleMatch = _context . API . FuzzySearch ( query . Search , c . Title ) ;
83
83
var subTitleMatch = _context . API . FuzzySearch ( query . Search , c . SubTitle ) ;
84
+ var keywordMatch = _context . API . FuzzySearch ( query . Search , command . Keyword ) ;
84
85
86
+ // Get the largest score from them
85
87
var score = Math . Max ( titleMatch . Score , subTitleMatch . Score ) ;
86
- if ( score > 0 )
88
+ var finalScore = Math . Max ( score , keywordMatch . Score ) ;
89
+ if ( finalScore > 0 )
87
90
{
88
- c . Score = score ;
91
+ c . Score = finalScore ;
89
92
90
- if ( score == titleMatch . Score )
93
+ // If title match has the highest score, highlight title
94
+ if ( finalScore == titleMatch . Score )
95
+ {
91
96
c . TitleHighlightData = titleMatch . MatchData ;
92
-
93
- results . Add ( c ) ;
94
- }
95
-
96
- // If no match found, we will search the keyword
97
- score = _context . API . FuzzySearch ( query . Search , command . Keyword ) . Score ;
98
- if ( score > 0 )
99
- {
100
- c . Score = score ;
97
+ }
101
98
102
99
results . Add ( c ) ;
103
100
}
You can’t perform that action at this time.
0 commit comments