mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add demo for FuzzySharp (Levenshtein)
This commit is contained in:
parent
309ee29bda
commit
68811fa324
3 changed files with 20 additions and 3 deletions
|
|
@ -65,8 +65,8 @@ namespace Flow.Launcher.Plugin.SharedModels
|
|||
|
||||
public enum SearchPrecisionScore
|
||||
{
|
||||
Regular = 50,
|
||||
Low = 20,
|
||||
Regular = 0,
|
||||
Low = 0,
|
||||
None = 0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FuzzySharp" Version="2.0.2" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -93,10 +93,26 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
matchResult.MatchData = new List<int>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var newScore = FuzzySharp.Fuzz.PartialTokenSetRatio(query.ToLower(), Name.ToLower());
|
||||
if (Name.Length < query.Length)
|
||||
newScore = 0;
|
||||
|
||||
var oldScore = matchResult.RawScore;
|
||||
matchResult.RawScore = Math.Max(newScore, oldScore);
|
||||
matchResult.MatchData = new List<int>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var result = new Result
|
||||
{
|
||||
Title = title,
|
||||
Title = title + $"<{matchResult.Score}> <{newScore}> <{oldScore}>",
|
||||
SubTitle = LnkResolvedPath ?? FullPath,
|
||||
IcoPath = IcoPath,
|
||||
Score = matchResult.Score,
|
||||
|
|
|
|||
Loading…
Reference in a new issue