update old hotkey trigger to use ActionKeyword

This commit is contained in:
Jeremy Wu 2020-07-15 05:52:01 +10:00
parent a1e371b7e8
commit ace9dc7f2c
2 changed files with 5 additions and 13 deletions

View file

@ -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:";
}
}

View file

@ -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<Result>();
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<Result> DirectoryInfoClassSearch(Query query, string querySearch)