Querying the Index Programmatically
There are several ways to use Windows Search to query the index.
This section provides the conceptual framework for querying the index programmatically:
- Using SQL and AQS Approaches to Query the Index
- Querying the Index with ISearchQueryHelper
- Querying the Index with the search-ms Protocol
- Querying the Index with Windows Search SQL Syntax
- Using Advanced Query Syntax Programmatically
Note Legacy Microsoft Windows Desktop Search (WDS) 2x compatibility: On computers running Windows XP and later, ISearchDesktop is deprecated. Instead, developers should use ISearchQueryHelper to get a connection string and to parse the user's query into Structured Query Language (SQL), and then query through Object Linking and Embedding Database (OLE DB).
Additional Resources
- For information on OLE DB, see OLE DB Programming Overview. For information on the .NET Framework Data Provider for OLE DB, see the System.Data.OleDb Namespace.
- For additional background on using of properties in querying, see the following topics:
- For information on how to create and modify search folders, see ISearchFolderItemFactory Interface.
- For community-supported question and discussion message boards on Search technologies, see MSDN Forum: Windows Desktop Search Development.
- To download the Search SDK Code Samples:
- For Windows 7: Windows Search Samples on Code Gallery
- For Windows Vista: Windows Search SDK Samples
- To download the Windows SDK:
- For Windows 7: Windows SDK for Windows 7 and .NET Framework
- For Windows Vista: Windows SDK for Windows Vista and .NET Framework
Related topics
- Windows Search Development Guide
- Managing the Index
- Extending the Windows Search Index
- Extending Language Resources
Send comments about this topic to Microsoft
Build date: 2/14/2012
thank you.
- 6/3/2010
- ifflanb
For example:
"SELECT System.ItemUrl FROM SYSTEMINDEX.. SCOPE() WHERE SCOPE='file:c:Users/User1' AND System.Keywords='someKeyWords'
Any solution would be appreciated.
- 12/21/2009
- miridfd
The ADO.NET and C# code sample does not work unless you use the connection string from the Visual Basic sample.
The recommended way to get the correct connection string is to use the QueryHelper Object get_ConnectionString() method (see http://msdn2.microsoft.com/en-us/library/bb266518(VS.85).aspx for sample code)
- 9/24/2007
- JChung2007
- 12/26/2007
- Thermous