fix scenario windows index

still returned indexed subfolder results despite top level is not indexed when searching for top level. eg. searching for c:\
This commit is contained in:
Jeremy Wu 2020-06-01 08:03:04 +10:00
parent 1cea02a300
commit f2690ebfe2
2 changed files with 6 additions and 12 deletions

View file

@ -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");

View file

@ -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<Result> TopLevelFolderSearchBehaviour(
Func<Query, string, List<Result>> windowsIndexSearch,
Func<Query, string, List<Result>> directoryInfoClassSearch,
Func<string, bool> 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<Result> WindowsIndexFilesAndFoldersSearch(Query query, string querySearchString)