diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs index acd960ef149..14833bae9b1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/DirectoryInfo/DirectoryInfoSearch.cs @@ -62,11 +62,11 @@ private static List DirectorySearch(EnumerationOptions enumerationOption if (fileSystemInfo is System.IO.DirectoryInfo) { folderList.Add(ResultManager.CreateFolderResult(fileSystemInfo.Name, fileSystemInfo.FullName, - fileSystemInfo.FullName, query, true, false)); + fileSystemInfo.FullName, query, 0, true, false)); } else { - fileList.Add(ResultManager.CreateFileResult(fileSystemInfo.FullName, query, true, false)); + fileList.Add(ResultManager.CreateFileResult(fileSystemInfo.FullName, query, 0, true, false)); } token.ThrowIfCancellationRequested(); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs index d71e9ab49a8..2dc09b55b91 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs @@ -15,14 +15,14 @@ internal static List AccessLinkListMatched(Query query, List var queriedAccessLinks = accessLinks - .Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase)) + .Where(x => x.Nickname.Contains(search, StringComparison.OrdinalIgnoreCase)) .OrderBy(x => x.Type) .ThenBy(x => x.Nickname); return queriedAccessLinks.Select(l => l.Type switch { - ResultType.Folder => ResultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query), - ResultType.File => ResultManager.CreateFileResult(l.Path, query), + ResultType.Folder => ResultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query, 100), + ResultType.File => ResultManager.CreateFileResult(l.Path, query, 100), _ => throw new ArgumentOutOfRangeException() }).ToList(); @@ -35,7 +35,7 @@ internal static List AccessLinkListAll(Query query, List acc .Select(l => l.Type switch { ResultType.Folder => ResultManager.CreateFolderResult(l.Nickname, l.Path, l.Path, query), - ResultType.File => ResultManager.CreateFileResult(l.Path, query), + ResultType.File => ResultManager.CreateFileResult(l.Path, query, 100), _ => throw new ArgumentOutOfRangeException() }).ToList(); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 6872f04b445..f756f8a0a7e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -16,7 +16,7 @@ public static void Init(PluginInitContext context) Context = context; } - internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, bool showIndexState = false, bool windowsIndexed = false) + internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false) { return new Result { @@ -46,6 +46,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string query.ActionKeyword + " " + changeTo); return false; }, + Score = score, TitleToolTip = Constants.ToolTipOpenDirectory, SubTitleToolTip = Constants.ToolTipOpenDirectory, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed } @@ -69,9 +70,9 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn if (retrievedDirectoryPath != path) title = "Open " + folderName; - + var subtitleFolderName = folderName; - + // ie. max characters can be displayed without subtitle cutting off: "Program Files (x86)" if (folderName.Length > 19) subtitleFolderName = "the directory"; @@ -94,7 +95,7 @@ internal static Result CreateOpenCurrentFolderResult(string path, bool windowsIn }; } - internal static Result CreateFileResult(string filePath, Query query, bool showIndexState = false, bool windowsIndexed = false) + internal static Result CreateFileResult(string filePath, Query query, int score = 0, bool showIndexState = false, bool windowsIndexed = false) { var result = new Result { @@ -102,6 +103,7 @@ internal static Result CreateFileResult(string filePath, Query query, bool showI SubTitle = filePath, IcoPath = filePath, TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, + Score = score, Action = c => { try diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs index 22d89ba8fff..0748b0cfef6 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs @@ -53,11 +53,11 @@ internal async static Task> ExecuteWindowsIndexSearchAsync(string i dataReaderResults.GetString(0), path, path, - query, true, true)); + query, 0, true, true)); } else { - fileResults.Add(ResultManager.CreateFileResult(path, query, true, true)); + fileResults.Add(ResultManager.CreateFileResult(path, query, 0, true, true)); } } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 990ceadda22..e3b75219dfe 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -7,7 +7,7 @@ "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.7.2", + "Version": "1.7.3", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",