Skip to content

Commit

Permalink
Fix results for multi-word matches
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhao271 committed Feb 20, 2025
1 parent 35cb504 commit f2f1445
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export class LocalSearchProvider implements ISearchProvider {
null;
};

const filterMatches = preferencesModel.filterSettings(this._filter, this.getGroupFilter(this._filter), settingMatcher);
const filterMatches = preferencesModel
.filterSettings(this._filter, this.getGroupFilter(this._filter), settingMatcher)
.filter(match => match.matchType !== SettingMatchType.None);
const exactMatch = filterMatches.find(m => m.score === LocalSearchProvider.EXACT_MATCH_SCORE);
if (exactMatch) {
return Promise.resolve({
Expand Down Expand Up @@ -207,6 +209,10 @@ export class SettingMatches {
if (this.useNewKeyMatchingSearch) {
if (keyMatchingWords.size === queryWords.size) {
this.matchType |= SettingMatchType.AllWordsKeyMatch;
} else if (keyMatchingWords.size >= 2) {
// At least two words matched.
this.matchType |= SettingMatchType.KeyMatch;
this.keyMatchScore = keyMatchingWords.size;
}
} else {
// Fall back to the old algorithm.
Expand Down

0 comments on commit f2f1445

Please sign in to comment.