From f2690ebfe29796111995b89c07af2ea8da2a4807 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 1 Jun 2020 08:03:04 +1000 Subject: [PATCH] fix scenario windows index still returned indexed subfolder results despite top level is not indexed when searching for top level. eg. searching for c:\ --- Flow.Launcher.Test/Plugins/ExplorerTest.cs | 8 ++------ .../Search/SearchManager.cs | 10 ++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs index 7f049fe3e..ca4e96a07 100644 --- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs +++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs @@ -34,10 +34,6 @@ namespace Flow.Launcher.Test.Plugins }; } - private bool MethodIndexExistsReturnsTrue(string dummyString) => true; - - private bool MethodIndexExistsReturnsFalse(string dummyString) => false; - private bool PreviousLocationExistsReturnsTrue(string dummyString) => true; private bool PreviousLocationNotExistReturnsFalse(string dummyString) => false; @@ -154,7 +150,7 @@ namespace Flow.Launcher.Test.Plugins var results = searchManager.TopLevelFolderSearchBehaviour( MethodWindowsIndexSearchReturnsZeroResults, MethodDirectoryInfoClassSearchReturnsTwoResults, - MethodIndexExistsReturnsFalse, + false, new Query(), "string not used"); @@ -174,7 +170,7 @@ namespace Flow.Launcher.Test.Plugins var results = searchManager.TopLevelFolderSearchBehaviour( MethodWindowsIndexSearchReturnsZeroResults, MethodDirectoryInfoClassSearchReturnsTwoResults, - MethodIndexExistsReturnsTrue, + true, new Query(), "string not used"); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 44a685427..cc6b5ce79 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo; +using Flow.Launcher.Plugin.Explorer.Search.DirectoryInfo; using Flow.Launcher.Plugin.Explorer.Search.QuickFolderLinks; using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex; using Flow.Launcher.Plugin.SharedCommands; @@ -78,16 +78,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search public List TopLevelFolderSearchBehaviour( Func> windowsIndexSearch, Func> directoryInfoClassSearch, - Func indexExists, + bool indexExists, Query query, string querySearchString) { - var results = windowsIndexSearch(query, querySearchString); - - if (results.Count == 0 && !indexExists(querySearchString)) + if (!indexExists) return directoryInfoClassSearch(query, querySearchString); - return results; + return windowsIndexSearch(query, querySearchString); } private List WindowsIndexFilesAndFoldersSearch(Query query, string querySearchString)