@@ -47,17 +47,17 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
47
47
return new MatchResult ( false , UserSettingSearchPrecision ) ;
48
48
49
49
query = query . Trim ( ) ;
50
- TranslationMapping map ;
51
- ( stringToCompare , map ) = _alphabet ? . Translate ( stringToCompare ) ?? ( stringToCompare , null ) ;
50
+ TranslationMapping translationMapping ;
51
+ ( stringToCompare , translationMapping ) = _alphabet ? . Translate ( stringToCompare ) ?? ( stringToCompare , null ) ;
52
52
53
53
var currentAcronymQueryIndex = 0 ;
54
54
var acronymMatchData = new List < int > ( ) ;
55
- var queryWithoutCase = opt . IgnoreCase ? query . ToLower ( ) : query ;
56
55
57
56
// preset acronymScore
58
57
int acronymScore = 100 ;
59
58
60
59
var fullStringToCompareWithoutCase = opt . IgnoreCase ? stringToCompare . ToLower ( ) : stringToCompare ;
60
+ var queryWithoutCase = opt . IgnoreCase ? query . ToLower ( ) : query ;
61
61
62
62
var querySubstrings = queryWithoutCase . Split ( new [ ] { ' ' } , StringSplitOptions . RemoveEmptyEntries ) ;
63
63
int currentQuerySubstringIndex = 0 ;
@@ -136,7 +136,6 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
136
136
continue ;
137
137
}
138
138
139
-
140
139
if ( firstMatchIndex < 0 )
141
140
{
142
141
// first matched char will become the start of the compared string
@@ -197,7 +196,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
197
196
// return acronym Match if possible
198
197
if ( acronymMatchData . Count == query . Length && acronymScore >= ( int ) UserSettingSearchPrecision )
199
198
{
200
- acronymMatchData = acronymMatchData . Select ( x => map ? . MapToOriginalIndex ( x ) ?? x ) . Distinct ( ) . ToList ( ) ;
199
+ acronymMatchData = acronymMatchData . Select ( x => translationMapping ? . MapToOriginalIndex ( x ) ?? x ) . Distinct ( ) . ToList ( ) ;
201
200
return new MatchResult ( true , UserSettingSearchPrecision , acronymMatchData , acronymScore ) ;
202
201
}
203
202
@@ -208,7 +207,7 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
208
207
var score = CalculateSearchScore ( query , stringToCompare , firstMatchIndex - nearestSpaceIndex - 1 ,
209
208
lastMatchIndex - firstMatchIndex , allSubstringsContainedInCompareString ) ;
210
209
211
- var resultList = indexList . Select ( x => map ? . MapToOriginalIndex ( x ) ?? x ) . Distinct ( ) . ToList ( ) ;
210
+ var resultList = indexList . Select ( x => translationMapping ? . MapToOriginalIndex ( x ) ?? x ) . Distinct ( ) . ToList ( ) ;
212
211
return new MatchResult ( true , UserSettingSearchPrecision , resultList , score ) ;
213
212
}
214
213
0 commit comments