@@ -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 ;
@@ -83,7 +83,8 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
83
83
{
84
84
case char c when compareIndex == 0 && queryWithoutCase [ currentQueryIndex ] == char . ToLower ( stringToCompare [ compareIndex ] )
85
85
|| ( char . IsUpper ( c ) && char . ToLower ( c ) == queryWithoutCase [ currentQueryIndex ] )
86
- || ( char . IsWhiteSpace ( c ) && char . ToLower ( stringToCompare [ ++ compareIndex ] ) == queryWithoutCase [ currentQueryIndex ] ) :
86
+ || ( char . IsWhiteSpace ( c ) && char . ToLower ( stringToCompare [ ++ compareIndex ] ) == queryWithoutCase [ currentQueryIndex ] )
87
+ || ( char . IsNumber ( c ) && c == queryWithoutCase [ currentQueryIndex ] ) :
87
88
acronymMatchData . Add ( compareIndex ) ;
88
89
currentQueryIndex ++ ;
89
90
continue ;
@@ -92,7 +93,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
92
93
compareIndex ++ ;
93
94
acronymScore -= 10 ;
94
95
break ;
95
- case char c when char . IsUpper ( c ) :
96
+ case char c when char . IsUpper ( c ) || char . IsNumber ( c ) :
96
97
acronymScore -= 10 ;
97
98
break ;
98
99
}
@@ -103,7 +104,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
103
104
104
105
var fullStringToCompareWithoutCase = opt . IgnoreCase ? stringToCompare . ToLower ( ) : stringToCompare ;
105
106
106
-
107
+
107
108
var querySubstrings = queryWithoutCase . Split ( new [ ] { ' ' } , StringSplitOptions . RemoveEmptyEntries ) ;
108
109
int currentQuerySubstringIndex = 0 ;
109
110
var currentQuerySubstring = querySubstrings [ currentQuerySubstringIndex ] ;
@@ -186,7 +187,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
186
187
currentQuerySubstringCharacterIndex = 0 ;
187
188
}
188
189
}
189
-
190
+
190
191
// proceed to calculate score if every char or substring without whitespaces matched
191
192
if ( allQuerySubstringsMatched )
192
193
{
@@ -229,7 +230,7 @@ private static bool AllPreviousCharsMatched(int startIndexToVerify, int currentQ
229
230
230
231
return allMatch ;
231
232
}
232
-
233
+
233
234
private static List < int > GetUpdatedIndexList ( int startIndexToVerify , int currentQuerySubstringCharacterIndex , int firstMatchIndexInWord , List < int > indexList )
234
235
{
235
236
var updatedList = new List < int > ( ) ;
0 commit comments