fix exclusion of Windows Index file or folder search

This commit is contained in:
Jeremy Wu 2021-03-15 06:01:29 +11:00
parent 8577dbe3bf
commit 43f1cae350
2 changed files with 25 additions and 2 deletions

View file

@ -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<Result> FilterOutResultsFromWindowsIndexExclusionList(HashSet<Result> results)
{
var indexExclusionList = settings.IndexSearchExcludedSubdirectoryPaths;
var indexExclusionListCount = indexExclusionList.Count;
if (indexExclusionListCount == 0)
return results;
var filteredResults = new HashSet<Result>(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);

View file

@ -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",