diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs index 559ef4647..174bdcfae 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs @@ -95,13 +95,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex return new List(); var constructedQuery = constructQuery(searchString); - return await RemoveResultsInExclusionList( + return RemoveResultsInExclusionList( await ExecuteWindowsIndexSearchAsync(constructedQuery, connectionString, query, token).ConfigureAwait(false), exclusionList, - token).ConfigureAwait(false); + token); } - private async static Task> RemoveResultsInExclusionList(List results, List exclusionList, CancellationToken token) + private static List RemoveResultsInExclusionList(List results, List exclusionList, CancellationToken token) { var indexExclusionListCount = exclusionList.Count; @@ -110,38 +110,28 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex var filteredResults = new List(); - try + for (var index = 0; index < results.Count; index++) { - await Task.Run(() => + token.ThrowIfCancellationRequested(); + + var excludeResult = false; + + for (var i = 0; i < indexExclusionListCount; i++) { - for (var index = 0; index < results.Count; index++) + token.ThrowIfCancellationRequested(); + + if (results[index].SubTitle.StartsWith(exclusionList[i].Path, StringComparison.OrdinalIgnoreCase)) { - token.ThrowIfCancellationRequested(); - - var excludeResult = false; - - for (var i = 0; i < indexExclusionListCount; i++) - { - token.ThrowIfCancellationRequested(); - - if (results[index].SubTitle.StartsWith(exclusionList[i].Path, StringComparison.OrdinalIgnoreCase)) - { - excludeResult = true; - break; - } - } - - if (!excludeResult) - filteredResults.Add(results[index]); + excludeResult = true; + break; } - }, token); + } - return filteredResults; - } - catch (OperationCanceledException) - { - return new List(); + if (!excludeResult) + filteredResults.Add(results[index]); } + + return filteredResults; } internal static bool PathIsIndexed(string path)