From ace9dc7f2ca806edabf60516c2298809bd8cef16 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 15 Jul 2020 05:52:01 +1000 Subject: [PATCH] update old hotkey trigger to use ActionKeyword --- .../Search/Constants.cs | 2 -- .../Search/SearchManager.cs | 16 +++++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs index 9664ad09b..db2eaa722 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs @@ -28,7 +28,5 @@ namespace Flow.Launcher.Plugin.Explorer.Search internal static string ExplorerIconImageFullPath => Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString()) + "\\" + ExplorerIconImagePath; - - internal const string WindowsIndexFileContentSearchHotkey = "content:"; } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 631dd0c31..a2b5cfa1f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -42,7 +42,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search if (string.IsNullOrEmpty(querySearch)) return results; - if (IsFileContentSearch(querySearch)) + if (IsFileContentSearch(query.ActionKeyword)) return WindowsIndexFileContentSearch(query, querySearch); var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch); @@ -81,24 +81,18 @@ namespace Flow.Launcher.Plugin.Explorer.Search { var queryConstructor = new QueryConstructor(settings); - var updatedQuerySearchString = querySearchString - .Substring(querySearchString - .IndexOf(Constants.WindowsIndexFileContentSearchHotkey) - + Constants.WindowsIndexFileContentSearchHotkey.Length); - - if (string.IsNullOrEmpty(updatedQuerySearchString)) + if (string.IsNullOrEmpty(querySearchString)) return new List(); - return indexSearch.WindowsIndexSearch(updatedQuerySearchString.TrimStart(), + return indexSearch.WindowsIndexSearch(querySearchString, queryConstructor.CreateQueryHelper().ConnectionString, queryConstructor.QueryForFileContentSearch, query); } - public bool IsFileContentSearch(string querySearch) + public bool IsFileContentSearch(string actionKeyword) { - return querySearch.StartsWith(Constants.WindowsIndexFileContentSearchHotkey, - StringComparison.OrdinalIgnoreCase); + return actionKeyword == settings.FileContentSearchActionKeyword; } private List DirectoryInfoClassSearch(Query query, string querySearch)