diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index d5f882d5c..15ffa19c4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -67,7 +67,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search { results.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token).ConfigureAwait(false)); - return results.ToList(); + return FilterOutResultsFromWindowsIndexExclusionList(results).ToList(); } var locationPath = querySearch; @@ -159,6 +159,29 @@ namespace Flow.Launcher.Plugin.Explorer.Search token).ConfigureAwait(false); } + private HashSet FilterOutResultsFromWindowsIndexExclusionList(HashSet results) + { + var indexExclusionList = settings.IndexSearchExcludedSubdirectoryPaths; + + var indexExclusionListCount = indexExclusionList.Count; + + if (indexExclusionListCount == 0) + return results; + + var filteredResults = new HashSet(PathEqualityComparator.Instance); + + foreach (var r in results) + { + for (var i = 0; i < indexExclusionListCount; i++) + { + if (!r.SubTitle.StartsWith(indexExclusionList[0].Path, StringComparison.OrdinalIgnoreCase)) + filteredResults.Add(r); + } + } + + return filteredResults; + } + private bool UseWindowsIndexForDirectorySearch(string locationPath) { var pathToDirectory = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 63ca66a1e..990ceadda 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.1", + "Version": "1.7.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll",