diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs
index 18426bafb..f4028b27d 100644
--- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs
+++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs
@@ -37,9 +37,37 @@ namespace Flow.Launcher.Test.Plugins
$"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " +
$"Actual string was: {queryString}{Environment.NewLine}");
}
-
- public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryWhereRestrictionsShouldUseScopeString() { }
+ [TestCase("scope='file:'")]
+ public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryWhereRestrictionsShouldUseScopeString(string expectedString)
+ {
+ // Given
+ var queryConstructor = new QueryConstructor(new Settings());
+
+ //When
+ var resultString = queryConstructor.QueryWhereRestrictionsForAllFilesAndFoldersSearch();
+
+ Assert.IsTrue(resultString == expectedString,
+ $"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " +
+ $"Actual string was: {resultString}{Environment.NewLine}");
+ }
+
+ [TestCase("flow.launcher.sln", "SELECT TOP 100 \"System.FileName\", \"System.ItemPathDisplay\" " +
+ "FROM \"SystemIndex\" WHERE (System.FileName LIKE 'flow.launcher.sln%' " +
+ "OR CONTAINS(System.FileName,'\"flow.launcher.sln*\"',1033)) AND scope='file:'")]
+ public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryShouldUseExpectedString(
+ string userSearchString, string expectedString)
+ {
+ // Given
+ var queryConstructor = new QueryConstructor(new Settings());
+
+ //When
+ var resultString = queryConstructor.QueryForAllFilesAndFolders(userSearchString);
+
+ Assert.IsTrue(resultString == expectedString,
+ $"Expected query string: {expectedString}{Environment.NewLine} " +
+ $"Actual string was: {resultString}{Environment.NewLine}");
+ }
public void GivenWindowsIndexSearch_WhenReturnedNilAndIsNotIndexed_ThenSearchMethodShouldContinueDirectoryInfoClassSearch() { }
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs
index 41b8040f3..b311b0b1d 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;
@@ -62,5 +62,21 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
return query;
}
+ ///
+ /// Search will be performed on all folders and files based on user's search keywords.
+ ///
+ public string QueryForAllFilesAndFolders(string userSearchString)
+ {
+ // Generate SQL from our parameters, converting the userQuery from AQS->WHERE clause
+ return CreateBaseQuery().GenerateSQLFromUserQuery(userSearchString) + " AND " + QueryWhereRestrictionsForAllFilesAndFoldersSearch();
+ }
+
+ ///
+ /// Set the required WHERE clause restriction to search for all files and folders.
+ ///
+ public string QueryWhereRestrictionsForAllFilesAndFoldersSearch()
+ {
+ return $"scope='file:'";
+ }
}
}