mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add base query constructor
This commit is contained in:
parent
634e263086
commit
26f0ce2778
1 changed files with 30 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Microsoft.Search.Interop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -8,11 +9,39 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
|
|||
{
|
||||
private Settings _settings;
|
||||
|
||||
private const string SystemIndex = "SystemIndex";
|
||||
|
||||
public QueryConstructor(Settings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public CSearchQueryHelper CreateBaseQuery()
|
||||
{
|
||||
// This uses the Microsoft.Search.Interop assembly
|
||||
CSearchManager manager = new CSearchManager();
|
||||
|
||||
// SystemIndex catalog is the default catalog in Windows
|
||||
ISearchCatalogManager catalogManager = manager.GetCatalog(SystemIndex);
|
||||
|
||||
// Get the ISearchQueryHelper which will help us to translate AQS --> SQL necessary to query the indexer
|
||||
var baseQuery = catalogManager.GetQueryHelper();
|
||||
|
||||
// Set the number of results we want. Don't set this property if all results are needed.
|
||||
baseQuery.QueryMaxResults = _settings.MaxResult;
|
||||
|
||||
// Set list of columns we want to display, getting the path presently
|
||||
baseQuery.QuerySelectColumns = "System.FileName, System.ItemPathDisplay";
|
||||
|
||||
// Filter based on folder/file name
|
||||
baseQuery.QueryContentProperties = "System.FileName";
|
||||
|
||||
// Set sorting order
|
||||
//baseQuery.QuerySorting = "System.ItemType DESC";
|
||||
|
||||
return baseQuery;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Search will be performed on all folders and files on the first level of a specified directory.
|
||||
///</summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue