Skip to content

Commit 16e032e

Browse files
authored
Merge pull request #1020 from Flow-Launcher/fix_win_settings_score
Fix WindowsSettings plugin result scores higher than normal
2 parents 11f1f40 + 7b6686d commit 16e032e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ internal static List<Result> GetResultList(
3434
var resultList = new List<Result>();
3535
foreach (var entry in list)
3636
{
37-
const int highScore = 20;
38-
const int midScore = 10;
37+
// Adjust the score to lower the order of many irrelevant matches from area strings
38+
// that may only be for description.
39+
const int nonNameMatchScoreAdj = 10;
3940

4041
Result? result;
4142
Debug.Assert(_api != null, nameof(_api) + " != null");
@@ -44,7 +45,7 @@ internal static List<Result> GetResultList(
4445

4546
if (nameMatch.IsSearchPrecisionScoreMet())
4647
{
47-
var settingResult = NewSettingResult(nameMatch.Score + highScore, entry.Type);
48+
var settingResult = NewSettingResult(nameMatch.Score, entry.Type);
4849
settingResult.TitleHighlightData = nameMatch.MatchData;
4950
result = settingResult;
5051
}
@@ -53,15 +54,15 @@ internal static List<Result> GetResultList(
5354
var areaMatch = _api.FuzzySearch(query.Search, entry.Area);
5455
if (areaMatch.IsSearchPrecisionScoreMet())
5556
{
56-
var settingResult = NewSettingResult(areaMatch.Score + midScore, entry.Type);
57+
var settingResult = NewSettingResult(areaMatch.Score - nonNameMatchScoreAdj, entry.Type);
5758
result = settingResult;
5859
}
5960
else
6061
{
6162
result = entry.AltNames?
6263
.Select(altName => _api.FuzzySearch(query.Search, altName))
6364
.Where(match => match.IsSearchPrecisionScoreMet())
64-
.Select(altNameMatch => NewSettingResult(altNameMatch.Score + midScore, entry.Type))
65+
.Select(altNameMatch => NewSettingResult(altNameMatch.Score - nonNameMatchScoreAdj, entry.Type))
6566
.FirstOrDefault();
6667
}
6768

@@ -75,7 +76,7 @@ internal static List<Result> GetResultList(
7576
.SelectMany(x => x)
7677
.Contains(x, StringComparer.CurrentCultureIgnoreCase))
7778
)
78-
result = NewSettingResult(midScore, entry.Type);
79+
result = NewSettingResult(nonNameMatchScoreAdj, entry.Type);
7980
}
8081
}
8182

@@ -115,7 +116,7 @@ private static string GetSubtitle(string section, string entryType)
115116
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
116117
{
117118
var toolTipText = new StringBuilder();
118-
119+
119120
var settingType = entry.Type == "AppSettingsApp" ? "System settings" : "Control Panel";
120121

121122
toolTipText.AppendLine($"{Resources.Application}: {settingType}");

Plugins/Flow.Launcher.Plugin.WindowsSettings/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Description": "Search settings inside Control Panel and Settings App",
55
"Name": "Windows Settings",
66
"Author": "TobiasSekan",
7-
"Version": "2.0.1",
7+
"Version": "2.0.2",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1010
"ExecuteFileName": "Flow.Launcher.Plugin.WindowsSettings.dll",

0 commit comments

Comments
 (0)