mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2415 from Flow-Launcher/fuzzy_search_access_links
Use FuzzySearch to search access links
This commit is contained in:
commit
57541b351a
2 changed files with 11 additions and 14 deletions
|
|
@ -13,20 +13,17 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
|||
if (string.IsNullOrEmpty(query.Search))
|
||||
return new List<Result>();
|
||||
|
||||
string search = query.Search.ToLower();
|
||||
|
||||
var queriedAccessLinks =
|
||||
accessLinks
|
||||
.Where(x => x.Name.Contains(search, StringComparison.OrdinalIgnoreCase) || x.Path.Contains(search, StringComparison.OrdinalIgnoreCase))
|
||||
return accessLinks
|
||||
.Where(x => Main.Context.API.FuzzySearch(query.Search, x.Name).IsSearchPrecisionScoreMet() || Main.Context.API.FuzzySearch(query.Search, x.Path).IsSearchPrecisionScoreMet())
|
||||
.OrderBy(x => x.Type)
|
||||
.ThenBy(x => x.Name);
|
||||
|
||||
return queriedAccessLinks.Select(l => l.Type switch
|
||||
{
|
||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore),
|
||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
}).ToList();
|
||||
.ThenBy(x => x.Name)
|
||||
.Select(l => l.Type switch
|
||||
{
|
||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore),
|
||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
internal static List<Result> AccessLinkListAll(Query query, IEnumerable<AccessLink> accessLinks)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
"Name": "Explorer",
|
||||
"Description": "Find and manage files and folders via Windows Search or Everything",
|
||||
"Author": "Jeremy Wu",
|
||||
"Version": "3.1.3",
|
||||
"Version": "3.1.4",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
||||
|
|
|
|||
Loading…
Reference in a new issue