diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index b7710d3324b..2fb16e0e1a4 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -9,6 +9,7 @@
Are you sure you want to permanently delete this {0}?
Deletion successful
Successfully deleted the {0}
+ Assigning the global action keyword could bring up too many results during search. Please choose a specific action keyword
Delete
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
index db2eaa72291..38939e244a5 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
@@ -22,6 +22,8 @@ internal static class Constants
internal const char AllFilesFolderSearchWildcard = '>';
+ internal const string DefaultContentSearchActionKeyword = "doc:";
+
internal const char DirectorySeperator = '\\';
internal const string WindowsIndexingOptions = "srchadmin.dll";
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs
index ebde039d680..8bd19956eab 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/FolderLinks/QuickFolderAccess.cs
@@ -6,14 +6,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
{
public class QuickFolderAccess
{
- internal List FolderList(Query query, List folderLinks, PluginInitContext context)
+ internal List FolderListMatched(Query query, List folderLinks, PluginInitContext context)
{
if (string.IsNullOrEmpty(query.Search))
- return folderLinks
- .Select(item =>
- new ResultManager(context)
- .CreateFolderResult(item.Nickname, item.Path, item.Path, query))
- .ToList();
+ return new List();
string search = query.Search.ToLower();
@@ -24,5 +20,11 @@ internal List FolderList(Query query, List folderLinks, Plug
.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
.ToList();
}
+
+ internal List FolderListAll(Query query, List folderLinks, PluginInitContext context)
+ => folderLinks
+ .Select(item =>
+ new ResultManager(context).CreateFolderResult(item.Nickname, item.Path, item.Path, query))
+ .ToList();
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 6c0d186f169..5b50b7fada6 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -34,16 +34,19 @@ internal List Search(Query query)
var querySearch = query.Search;
- var quickFolderLinks = quickFolderAccess.FolderList(query, settings.QuickFolderAccessLinks, context);
+ if (IsFileContentSearch(query.ActionKeyword))
+ return WindowsIndexFileContentSearch(query, querySearch);
- if (quickFolderLinks.Count > 0 && query.ActionKeyword == settings.SearchActionKeyword)
- return quickFolderLinks;
+ // This allows the user to type the assigned action keyword and only see the list of quick folder links
+ if (settings.QuickFolderAccessLinks.Count > 0
+ && query.ActionKeyword == settings.SearchActionKeyword
+ && string.IsNullOrEmpty(query.Search))
+ return quickFolderAccess.FolderListAll(query, settings.QuickFolderAccessLinks, context);
- if (string.IsNullOrEmpty(querySearch))
- return results;
+ var quickFolderLinks = quickFolderAccess.FolderListMatched(query, settings.QuickFolderAccessLinks, context);
- if (IsFileContentSearch(query.ActionKeyword))
- return WindowsIndexFileContentSearch(query, querySearch);
+ if (quickFolderLinks.Count > 0)
+ results.AddRange(quickFolderLinks);
var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch);
@@ -54,7 +57,11 @@ internal List Search(Query query)
var isEnvironmentVariablePath = querySearch.Substring(1).Contains("%\\");
if (!FilesFolders.IsLocationPathString(querySearch) && !isEnvironmentVariablePath)
- return WindowsIndexFilesAndFoldersSearch(query, querySearch);
+ {
+ results.AddRange(WindowsIndexFilesAndFoldersSearch(query, querySearch));
+
+ return results;
+ }
var locationPath = querySearch;
@@ -137,15 +144,17 @@ private List WindowsIndexTopLevelFolderSearch(Query query, string path)
private bool UseWindowsIndexForDirectorySearch(string locationPath)
{
+ var pathToDirectory = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath);
+
if (!settings.UseWindowsIndexForDirectorySearch)
return false;
if (settings.IndexSearchExcludedSubdirectoryPaths
- .Any(x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)
+ .Any(x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory)
.StartsWith(x.Path, StringComparison.OrdinalIgnoreCase)))
return false;
- return indexSearch.PathIsIndexed(locationPath);
+ return indexSearch.PathIsIndexed(pathToDirectory);
}
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
index cca4f209d44..4f9325c7754 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
@@ -21,7 +21,7 @@ internal class IndexSearch
private readonly ResultManager resultManager;
// Reserved keywords in oleDB
- private readonly string reservedStringPattern = @"^[\/\\\$\%]+$";
+ private readonly string reservedStringPattern = @"^[\/\\\$\%_]+$";
internal IndexSearch(PluginInitContext context)
{
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
index 4e62b3cba2a..5b12870c822 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
@@ -1,4 +1,5 @@
-using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
+using Flow.Launcher.Plugin.Explorer.Search;
+using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
using Newtonsoft.Json;
using System.Collections.Generic;
@@ -22,6 +23,6 @@ public class Settings
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
[JsonProperty]
- public string FileContentSearchActionKeyword { get; set; } = "doc:";
+ public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
}
}
\ 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 e14a6ebb54e..7fcd77f0775 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
@@ -54,5 +54,7 @@ internal void UpdateActionKeyword(string newActionKeyword, string oldActionKeywo
}
internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
+
+ internal bool IsNewActionKeywordGlobal(string newActionKeyword) => newActionKeyword == Query.GlobalPluginWildcardSign;
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
index b9e5373b7c5..2957283ad1f 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
@@ -51,8 +51,17 @@ private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
return;
}
+
+ if (settingsViewModel.IsNewActionKeywordGlobal(newActionKeyword)
+ && currentActionKeyword.Description
+ == settingsViewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch"))
+ {
+ MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
+
+ return;
+ }
- if(!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
+ if (!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
{
settingsViewModel.UpdateActionKeyword(newActionKeyword, currentActionKeyword.Keyword);