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))
|
if (string.IsNullOrEmpty(query.Search))
|
||||||
return new List<Result>();
|
return new List<Result>();
|
||||||
|
|
||||||
string search = query.Search.ToLower();
|
return accessLinks
|
||||||
|
.Where(x => Main.Context.API.FuzzySearch(query.Search, x.Name).IsSearchPrecisionScoreMet() || Main.Context.API.FuzzySearch(query.Search, x.Path).IsSearchPrecisionScoreMet())
|
||||||
var queriedAccessLinks =
|
|
||||||
accessLinks
|
|
||||||
.Where(x => x.Name.Contains(search, StringComparison.OrdinalIgnoreCase) || x.Path.Contains(search, StringComparison.OrdinalIgnoreCase))
|
|
||||||
.OrderBy(x => x.Type)
|
.OrderBy(x => x.Type)
|
||||||
.ThenBy(x => x.Name);
|
.ThenBy(x => x.Name)
|
||||||
|
.Select(l => l.Type switch
|
||||||
return queriedAccessLinks.Select(l => l.Type switch
|
{
|
||||||
{
|
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore),
|
||||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore),
|
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
|
||||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
_ => throw new ArgumentOutOfRangeException()
|
})
|
||||||
}).ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<Result> AccessLinkListAll(Query query, IEnumerable<AccessLink> accessLinks)
|
internal static List<Result> AccessLinkListAll(Query query, IEnumerable<AccessLink> accessLinks)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
"Name": "Explorer",
|
"Name": "Explorer",
|
||||||
"Description": "Find and manage files and folders via Windows Search or Everything",
|
"Description": "Find and manage files and folders via Windows Search or Everything",
|
||||||
"Author": "Jeremy Wu",
|
"Author": "Jeremy Wu",
|
||||||
"Version": "3.1.3",
|
"Version": "3.1.4",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue