diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 3a1a1fb05..71b16f159 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -22,6 +22,8 @@ Index Search Activation: Path Explore Activation: File Content Search: + Index Only Search: + (Disabled) Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 1cb82b75f..4ff6070d4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -46,12 +46,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search var result = new HashSet(PathEqualityComparator.Instance); - if (ActionKeywordMatch(query, settings.PathSearchActionKeyword)) + if (ActionKeywordMatch(query, settings.PathSearchActionKeyword) || ActionKeywordMatch(query, settings.SearchActionKeyword)) { result.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false)); } - if (ActionKeywordMatch(query, settings.SearchActionKeyword) && + if ((ActionKeywordMatch(query, settings.IndexOnlySearchActionKeyword) || ActionKeywordMatch(query, settings.SearchActionKeyword)) && querySearch.Length > 0 && !querySearch.IsLocationPathString()) { @@ -61,10 +61,15 @@ namespace Flow.Launcher.Plugin.Explorer.Search return result.ToList(); } - private bool ActionKeywordMatch(Query query, string actionKeyword) + private bool ActionKeywordMatch(Query query, string allowedActionKeyword) { - return query.ActionKeyword == actionKeyword || - query.ActionKeyword.Length == 0 && actionKeyword == Query.GlobalPluginWildcardSign; + if (settings.EnabledIndexOnlySearchKeyword && (settings.IndexOnlySearchActionKeyword == Query.GlobalPluginWildcardSign || query.ActionKeyword == allowedActionKeyword)) + return true; + + if (settings.EnabledPathSearchKeyword && (settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign || query.ActionKeyword == allowedActionKeyword)) + return true; + + return settings.SearchActionKeyword == Query.GlobalPluginWildcardSign || query.ActionKeyword == allowedActionKeyword; } public async Task> PathSearchAsync(Query query, CancellationToken token = default) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index e078bca67..0359b00f7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -22,5 +22,11 @@ namespace Flow.Launcher.Plugin.Explorer public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; + + public bool EnabledPathSearchKeyword { get; set; } + + public string IndexOnlySearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; + + public bool EnabledIndexOnlySearchKeyword { get; set; } } } \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 9d4019b9a..ae84f92d4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -59,6 +59,9 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels case ActionKeywordProperty.FileContentSearchActionKeyword: Settings.FileContentSearchActionKeyword = newActionKeyword; break; + case ActionKeywordProperty.IndexOnlySearchActionKeyword: + Settings.IndexOnlySearchActionKeyword = newActionKeyword; + break; } } @@ -71,6 +74,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels { SearchActionKeyword, PathSearchActionKeyword, - FileContentSearchActionKeyword + FileContentSearchActionKeyword, + IndexOnlySearchActionKeyword } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml index 0e1c7e872..b49ae3465 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -16,6 +16,7 @@ + @@ -23,8 +24,9 @@ Margin="10" Grid.Row="0" Width="105" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" /> - - + +