diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs
index 055a358bc..18426bafb 100644
--- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs
+++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs
@@ -24,6 +24,21 @@ namespace Flow.Launcher.Test.Plugins
$"Actual: {result}{Environment.NewLine}");
}
+ [TestCase("C:\\Dropbox", "SELECT TOP 100 System.FileName, System.ItemPathDisplay FROM SystemIndex WHERE directory='file:C:\\Dropbox'")]
+ public void GivenWindowsIndexSearch_WhenSearchTypeIsSearchTopFolderLevel_ThenQueryShouldUseExpectedString(string folderPath, string expectedString)
+ {
+ // Given
+ var queryConstructor = new QueryConstructor(new Settings());
+
+ //When
+ var queryString = queryConstructor.QueryForTopLevelDirectorySearch(folderPath);
+
+ Assert.IsTrue(queryString == expectedString,
+ $"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " +
+ $"Actual string was: {queryString}{Environment.NewLine}");
+ }
+
+
public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryWhereRestrictionsShouldUseScopeString() { }
public void GivenWindowsIndexSearch_WhenReturnedNilAndIsNotIndexed_ThenSearchMethodShouldContinueDirectoryInfoClassSearch() { }
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
index 5f1ec0544..821c92714 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
@@ -16,6 +16,10 @@
..\..\Output\Release\Plugins\Flow.Launcher.Explorer
+
+
+
+
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs
index db2d80858..ab3d529ef 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs
@@ -1,4 +1,4 @@
-using Microsoft.Search.Interop;
+using Microsoft.Search.Interop;
using System;
using System.Collections.Generic;
using System.Text;
@@ -51,5 +51,14 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
return $"directory='file:{path}'";
}
+ public string QueryForTopLevelDirectorySearch(string folderPath)
+ {
+ string query = "SELECT TOP " + _settings.MaxResult + $" {CreateBaseQuery().QuerySelectColumns} FROM {SystemIndex} WHERE ";
+
+ query += QueryWhereRestrictionsForTopLevelDirectorySearch(folderPath);
+
+ return query;
+ }
+
}
}