4.1 KiB
4.1 KiB
Indexer Plugin
The indexer plugin is used to search for files within the indexed locations of the system.
Drive Detection
- There are two indexing modes in Windows:
- Classic mode: Only the desktop and certain customizable locations in the system are indexed. All the systems have the classic mode enabled by default.
- 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 forEnableFindMyFiles
. If it is set to 1, the enhanced mode is enabled.
OleDBSearch
- The
Query
function within theOleDBSearch.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 theOleDBSearch.cs
class to execute the query. - It initializes the
QueryHelper
in theInitQueryHelper()
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:
- 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 theLIKE
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.