mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
optimize use
This commit is contained in:
parent
b7a0ada60b
commit
2c9f4149b7
1 changed files with 5 additions and 2 deletions
|
|
@ -71,7 +71,7 @@ namespace Flow.Launcher.Infrastructure
|
||||||
|| (char.IsWhiteSpace(c) && char.ToLower(stringToCompare[++compareIndex]) ==
|
|| (char.IsWhiteSpace(c) && char.ToLower(stringToCompare[++compareIndex]) ==
|
||||||
queryWithoutCase[currentQueryIndex])
|
queryWithoutCase[currentQueryIndex])
|
||||||
|| (char.IsNumber(c) && c == queryWithoutCase[currentQueryIndex]):
|
|| (char.IsNumber(c) && c == queryWithoutCase[currentQueryIndex]):
|
||||||
acronymMatchData.Add(map?.MapToOriginalIndex(compareIndex) ?? compareIndex);
|
acronymMatchData.Add(compareIndex);
|
||||||
currentQueryIndex++;
|
currentQueryIndex++;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -86,7 +86,10 @@ namespace Flow.Launcher.Infrastructure
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acronymMatchData.Count == query.Length && acronymScore >= 60)
|
if (acronymMatchData.Count == query.Length && acronymScore >= 60)
|
||||||
|
{
|
||||||
|
acronymMatchData = acronymMatchData.Select(x => map?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
|
||||||
return new MatchResult(true, UserSettingSearchPrecision, acronymMatchData, acronymScore);
|
return new MatchResult(true, UserSettingSearchPrecision, acronymMatchData, acronymScore);
|
||||||
|
}
|
||||||
|
|
||||||
var fullStringToCompareWithoutCase = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare;
|
var fullStringToCompareWithoutCase = opt.IgnoreCase ? stringToCompare.ToLower() : stringToCompare;
|
||||||
|
|
||||||
|
|
@ -188,7 +191,7 @@ namespace Flow.Launcher.Infrastructure
|
||||||
var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1,
|
var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1,
|
||||||
lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString);
|
lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString);
|
||||||
|
|
||||||
var resultList = indexList.Distinct().Select(x => map?.MapToOriginalIndex(x) ?? x).ToList();
|
var resultList = indexList.Select(x => map?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
|
||||||
return new MatchResult(true, UserSettingSearchPrecision, resultList, score);
|
return new MatchResult(true, UserSettingSearchPrecision, resultList, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue