Skip to content

Commit 4331398

Browse files
committed
update summary, comments & formatting
1 parent 95325a8 commit 4331398

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Flow.Launcher.Infrastructure/StringMatcher.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ public MatchResult FuzzyMatch(string query, string stringToCompare)
3131
}
3232

3333
/// <summary>
34-
/// Current method includes two part, Acronym Match and Fuzzy Search:
34+
/// Current method has two parts, Acronym Match and Fuzzy Search:
3535
///
3636
/// Acronym Match:
37-
/// Charater lists below will be considered as Acronym
37+
/// Charater listed below will be considered as acronym
3838
/// 1. Character on index 0
3939
/// 2. Character appears after a space
4040
/// 3. Character that is UpperCase
4141
/// 4. Character that is number
4242
///
43-
/// Acronym Search will match all query when meeting with Acronyms in the stringToCompare
44-
/// If any of the character in Query isn't matched with the string, Acronym Search fail.
45-
/// Score will be calculated based on the number of mismatched acronym before all query has been matched
43+
/// Acronym Match will succeed when all query characters match with acronyms in stringToCompare.
44+
/// If any of the characters in the query isn't matched with stringToCompare, Acronym Match will fail.
45+
/// Score will be calculated based the percentage of all query characters matched with total acronyms in stringToCompare.
4646
///
4747
/// Fuzzy Search:
4848
/// Character matching + substring matching;
@@ -65,7 +65,6 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
6565

6666
var currentAcronymQueryIndex = 0;
6767
var acronymMatchData = new List<int>();
68-
6968
int acronymsTotalCount = 0;
7069
int acronymsMatched = 0;
7170

@@ -106,7 +105,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
106105
if (fullStringToCompareWithoutCase[compareStringIndex] == ' ' && currentQuerySubstringIndex == 0)
107106
spaceIndices.Add(compareStringIndex);
108107

109-
// Acronym check
108+
// Acronym Match
110109
if (IsAcronym(stringToCompare, compareStringIndex))
111110
{
112111
if (fullStringToCompareWithoutCase[compareStringIndex] ==
@@ -122,8 +121,6 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
122121
if (IsAcronymCount(stringToCompare, compareStringIndex))
123122
acronymsTotalCount++;
124123

125-
// Acronym end
126-
127124
if (allQuerySubstringsMatched || fullStringToCompareWithoutCase[compareStringIndex] !=
128125
currentQuerySubstring[currentQuerySubstringCharacterIndex])
129126
{
@@ -232,7 +229,6 @@ private bool IsAcronymCount(string stringToCompare, int compareStringIndex)
232229
if (IsAcronymNumber(stringToCompare, compareStringIndex))
233230
return compareStringIndex == 0 || char.IsWhiteSpace(stringToCompare[compareStringIndex - 1]);
234231

235-
236232
return false;
237233
}
238234

@@ -241,7 +237,8 @@ private bool IsAcronymChar(string stringToCompare, int compareStringIndex)
241237
compareStringIndex == 0 || // 0 index means char is the start of the compare string, which is an acronym
242238
char.IsWhiteSpace(stringToCompare[compareStringIndex - 1]);
243239

244-
private bool IsAcronymNumber(string stringToCompare, int compareStringIndex) => stringToCompare[compareStringIndex] >= 0 && stringToCompare[compareStringIndex] <= 9;
240+
private bool IsAcronymNumber(string stringToCompare, int compareStringIndex)
241+
=> stringToCompare[compareStringIndex] >= 0 && stringToCompare[compareStringIndex] <= 9;
245242

246243
// To get the index of the closest space which preceeds the first matching index
247244
private int CalculateClosestSpaceIndex(List<int> spaceIndices, int firstMatchIndex)

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ public Result Result(string query, IPublicAPI api)
298298
else matchResult = nameMatch;
299299
}
300300

301-
if (!matchResult.Success) return null;
301+
if (!matchResult.Success)
302+
return null;
302303

303304
var result = new Result
304305
{

0 commit comments

Comments
 (0)