Searching Data 

Vista provides enhanced search capabilities, enabling users to quickly access to full-text and metadata, including email, documents, Internet content and RSS feeds. Searches can be conducted based on name, type, full text and properties. Developers can extend search functionality to support custom types. Vista search technology is built on the OLE DB and ADO APIs, using a SQL-like syntax and returning a standard OLE DB Recordset. Search functionality can be accessed by both WinFX and native code-based applications.

File System Queries

Under Windows Vista, the file system becomes a fully accessible database. All search technology is built on the Microsoft OLE DB and ADO APIs. Queries use an SQL-like syntax, and return a standard an OLE DB Recordset. The search functionality can be accessed by both WinFX and native code based applications.

Native code (Win32) based applications follow must obtain an index data source object (DSO) from the OLE DB provider of Windows Vista shell's Indexing Service. Once connected to the indexing DSO, the application can creates a session object that. The session object is used to create command objects and execute queries against the indexing service: that is to search the file system.

Managed code will access the Windows Vista shell's indexing service through ADO.NET functionality and object under the System.Data.OleDb namespace. The Indexing Service is available under ADO.Net as the provider MSIDXS, and the specific data source is the indexing catalog name. Once connected, an application can use objects such as OleDbCommand and OleDbTransaction to query the indexing service data source: that is to search the file system.

Programming Model Documentation Links

Managed

System.Data.OleDb, Advanced COM Interoperability

Unmanaged

OLE DB Provider for Indexing Service

Vista Indexing Improvements

Vista provides an overhaul of the indexing mechanism to provide fast access to data. The indexing engine is lightweight and enabled by default. Information about a system is updated dynamically, which translates into enhanced search speeds.

The index engine has a small impact on the system by working during idle cycles where possible. This allows for fresh indexes without any overall degradation of system performance.

Managed code will access the Windows Vista shell's indexing service through ADO.NET functionality and object under the System.Data.OleDb namespace.

The Indexing Service is available under ADO.Net as the provider MSIDXS, and the specific data source is the indexing catalog name.

Programming Model Documentation Links

Managed

System.Data.OleDb, Advanced COM Interoperability

Unmanaged

OLE DB Provider for Indexing Service

SQL Query Language

Defining Searches

Vista searches can be defined in three ways:

  • Scope. The area of which to conduct the search.

  • Object type. Windows Explorer types as well as abstract types such as Picture, Document or Music are supported.

  • Filters. Selection is based on metadata properties.

  • View state. Searches can be performed on visible columns, view mode or organizational rules including sorts, grouping or stacking.

In addition, developers can create add-ins tailed to fit customer scenarios.

Developers can extend Windows Desktop Search to index the contents of new file types or data sources. By associating icons and context-menu handlers with Indexed data and new file types, developers can extend the end-user interface for flexibility and ease of use. There are two methods for creating add-ins for Desktop Search. The developer can create a new protocol handler for the new store, or use the IFilter Interface to create a new file type. If the add-in will manage a new application that uses custom file types or the add-in needs to extrapolate metadata, IFilter is the better choice.

Filtering Data

Vista filtering uses the same underlying mechanisms as search technologies. Users can define filters using file properties such as name, type, keyword, and custom metadata to organize the information that they see.

It is through the IPersistStream Interface and the IpersistFile Interface that the IFilter Interface retrieves the contents of the current item. The only purpose of an IFilter is to output property values. Many of these properties are used to correctly display the Desktop Search results view. Desktop Search extrapolates the current data, determines the index content, and creates the index.

Programming Model Documentation Links

Managed

System.Data.OleDb, Advanced COM Interoperability

Unmanaged

Property Filtering

IFilter Interface

IPersistStream Interface

IPersistFile Interface

Developing with Custom Data Stores

Developers can extend the built-in features of Vista to include new data and file types by writing a protocol handler add-in to Desktop Search. This allows Desktop Search to index the new data store, such as the database of an e-mail application. For a protocol handler, the IContextMenu Interface and the IExtractIcon Interface interfaces are made available to the Desktop Search results user interface.

Developers can implement a Shell Namespace Extension to provide a user interface for displaying custom data source items in the Shell.

Programming Model Documentation Links

Managed

System.Data.OleDb, Advanced COM Interoperability

Unmanaged

Shell Programmer's Guide

IContextMenu Interface

IExtractIcon Interface

Accessing Metadata

The most powerful tool in Windows Vista for accessing metadata properties is the IPropertyStore Interface, as it can be extended to cover any type of file or data added to the system.

In addition, the Windows Vista shell provides a number of C based functions, typically referred to as the SHGetPropertyDescription API set which can be used in conjunction with IPropertyStore or by themselves to manipulate properties.

The shell's implementation of the IPropertyDescription Interface, generally obtained with the SHGetPropertyDescription function, the SHGetPropertyDescriptionByName function, or the SHGetPropertyDescriptionListFromString provide detailed controls for displaying, enumerating, getting, and setting individual property values.

Managed applications can access this functionality through the Windows SDK's interoperability support. However, accessing metadata properties in managed code, even using interoperability functionality, is strongly discouraged due to versioning and error handling semantics.

Programming Model Documentation Links

Managed

Windows SDK interoperability support and System.ServiceModel

Unmanaged

Shell Programmer's Guide

IPropertyStore Interface

IInitializeWithStream Interface

IInitializeWithFile Interface

IPropertyStoreCache Interface

See Also

Concepts

Organizing Data
Sharing Data
Data Access