@@ -44,8 +44,8 @@ public MatchResult FuzzyMatch(string query, string stringToCompare)
44
44
/// </summary>
45
45
public MatchResult FuzzyMatch ( string query , string stringToCompare , MatchOption opt )
46
46
{
47
- if ( string . IsNullOrEmpty ( stringToCompare ) || string . IsNullOrEmpty ( query ) ) return new MatchResult ( false , UserSettingSearchPrecision ) ;
48
-
47
+ if ( string . IsNullOrEmpty ( stringToCompare ) || string . IsNullOrEmpty ( query ) ) return new MatchResult ( false , UserSettingSearchPrecision ) ;
48
+
49
49
query = query . Trim ( ) ;
50
50
51
51
stringToCompare = _alphabet ? . Translate ( stringToCompare ) ?? stringToCompare ;
@@ -77,7 +77,8 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
77
77
{
78
78
case char c when ( compareIndex == 0 && queryWithoutCase [ currentQueryIndex ] == char . ToLower ( stringToCompare [ compareIndex ] ) )
79
79
|| ( char . IsUpper ( c ) && char . ToLower ( c ) == queryWithoutCase [ currentQueryIndex ] )
80
- || ( char . IsWhiteSpace ( c ) && char . ToLower ( stringToCompare [ ++ compareIndex ] ) == queryWithoutCase [ currentQueryIndex ] ) :
80
+ || ( char . IsWhiteSpace ( c ) && char . ToLower ( stringToCompare [ ++ compareIndex ] ) == queryWithoutCase [ currentQueryIndex ] )
81
+ || ( char . IsNumber ( c ) && c == queryWithoutCase [ currentQueryIndex ] ) :
81
82
acronymMatchData . Add ( compareIndex ) ;
82
83
currentQueryIndex ++ ;
83
84
continue ;
@@ -86,7 +87,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
86
87
compareIndex ++ ;
87
88
acronymScore -= 10 ;
88
89
break ;
89
- case char c when char . IsUpper ( c ) :
90
+ case char c when char . IsUpper ( c ) || char . IsNumber ( c ) :
90
91
acronymScore -= 10 ;
91
92
break ;
92
93
}
@@ -97,7 +98,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
97
98
98
99
var fullStringToCompareWithoutCase = opt . IgnoreCase ? stringToCompare . ToLower ( ) : stringToCompare ;
99
100
100
-
101
+
101
102
var querySubstrings = queryWithoutCase . Split ( new [ ] { ' ' } , StringSplitOptions . RemoveEmptyEntries ) ;
102
103
int currentQuerySubstringIndex = 0 ;
103
104
var currentQuerySubstring = querySubstrings [ currentQuerySubstringIndex ] ;
@@ -180,7 +181,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
180
181
currentQuerySubstringCharacterIndex = 0 ;
181
182
}
182
183
}
183
-
184
+
184
185
// proceed to calculate score if every char or substring without whitespaces matched
185
186
if ( allQuerySubstringsMatched )
186
187
{
@@ -223,7 +224,7 @@ private static bool AllPreviousCharsMatched(int startIndexToVerify, int currentQ
223
224
224
225
return allMatch ;
225
226
}
226
-
227
+
227
228
private static List < int > GetUpdatedIndexList ( int startIndexToVerify , int currentQuerySubstringCharacterIndex , int firstMatchIndexInWord , List < int > indexList )
228
229
{
229
230
var updatedList = new List < int > ( ) ;
0 commit comments