PowerToys/doc/devdocs/modules/launcher/plugins/indexer.md
Aaron Junker 4e202e4523
[Docs]Replace docs.micrososft.com with learn.microsoft.com (#20662)
* Update SUPPORT.md

* Update runner.md

* Update guidance.md

* Update convert-stringtable-to-resx.ps1

* Update readme.md

* Update ControlType.cs

* Update README.md

* Update CLSID.h

* Update GenericProperty`1.cs

* Update project-overview.md

* Update interop.cpp

* Update PreviewHandlerBase.cs

* Update indexer.md

* Update common.md

* Update two_way_pipe_message_ipc.cpp

* Update PowerToys.exe.manifest

* Update HotkeySettings.cs

* push

* Update src/tests/win-app-driver/README.md

* Update doc/devdocs/akaLinks.md

* Update doc/devdocs/modules/launcher/plugins/registry.md
2022-09-28 17:18:55 +01:00

4.1 KiB

Indexer Plugin

The indexer plugin is used to search for files within the indexed locations of the system.

Image of Indexer plugin

Drive Detection

  • There are two indexing modes in Windows:
    1. Classic mode: Only the desktop and certain customizable locations in the system are indexed. All the systems have the classic mode enabled by default.
    2. Enhanced Mode: This mode indexes the entire PC when enabled. The user can exclude certain locations from being indexed in this mode from the Windows Search settings options.
  • A drive detection warning is displayed to the users when only the custom mode is enabled on the system informing the user that not all the locations on their PC are indexed as this could lead to some results not showing up.
  • The IndexerDriveDetection.cs file gets the status of the drive detection checkbox in the settings UI and depending on whether the enhanced mode is enabled or disabled, displays the warning.
  • To determine whether the EnhancedMode is enabled or not, we check the local machine registry entry for EnableFindMyFiles. If it is set to 1, the enhanced mode is enabled.

OleDBSearch

  • The Query function within the OleDBSearch.cs class takes in the query and the connection string to the SystemIndex catalog as arguments and returns a list of results.
  • It first opens a connection to the Windows Indexer database, creates an OleDB command and executes the command to get a list of results.

WindowsSearchAPI

  • The WindowsSearchAPI class leverages the OleDBSearch.cs class to execute the query.
  • It initializes the QueryHelper in the InitQueryHelper() function by creating a catalog manager to the SystemIndex catalog.
  • The metadata is initialized within the query helper, such as the number of results to retrieve, the type of information to retrieve for each file (currently we retrieve the item URL, the file name and the file attributes).
  • The query helper matches results using the name of the file only and they are sorted by the last modified date, ensuring that the recently modified files are ranked higher.
  • The File attributes are utilized to filter out hidden files from being displayed.

Additional Information

  • There are two major types of queries generated by the indexer plugin:
    1. Full Text predicates - eg: CONTAINS
    2. Non-Full Text predicates - eg: LIKE
  • The Full text predicates are much faster than non-full text predicates as they are based on finding matches rather than comparing the query with each item in the indexer database. Hence, queries which have the CONTAINS keyword are much faster than those which contain the LIKE keyword.
  • To prevent the indexer query from taking a long time and blocking the UI thread, there are two types of indexer queries which are executed. A simplified query and a full query, without and with the LIKE keyword respectively.
  • The result list is updated with the results of the full query once they are obtained.

Score

Each of the indexer plugin results has a score set to 0 so they are present at the bottom of the list.