IFilter Implementation

This section describes use of the IFilter interface in Microsoft Index Server, including functions and conventions that are specific to the Microsoft Index Server.

Persistent Handlers

Microsoft Index Server requires that implementations of the IFilter interface be registered as persistent handlers for COM classes. The specifics of the persistent handler mechanism may change in future releases of Windows NT or Index Server, but the pseudopersistent handler functions described later in this section will continue to be supported.

A persistent handler provides the same service for the persistent image of an object that the COM running object table provides for the loaded, in-memory image. The persistent handler is the broker between the persistent state of an object and clients that need to access that state. It is responsible for coordinating multiple client access to the persistent state of an object.

Multiple handlers may be defined to provide behavior for a single persistent object. Each interface may specify a unique handler for only that interface. Multiple handlers that are unaware of each other may all operate on the persistent image of the same object. It is the responsibility of the persistent handler to load the correct implementation for each interface.

The following registry entries are sufficient to load the implementation of IFilter for objects of type SampleObject.

\Registry\MACHINE\SOFTWARE\Classes
 
    .sam
        = REG_SZ SampleFile
 
    SampleFile
        = REG_SZ Class for Sample Files
        CLSID
           = REG_SZ {40A45370-0386-11D0-AE19-00AA004B9986}
    CLSID
        {40A45370-0386-11D0-AE19-00AA004B9986}
           = REG_SZ Sample Files
           InprocServer32
              = REG_SZ sample.dll
           PersistentHandler
               = REG_SZ {A6317C60-0386-11D0-AE19-00AA004B9986}
 
        {A6317C60-0386-11D0-AE19-00AA004B9986}
           = REG_SZ Sample file persistent handler
           PersistentAddinsRegistered
              {89BCB740-6119-101A-BCB7-00DD010655AF}
                 = REG_SZ {D7455400-0386-11D0-AE19-00AA004B9986}
 
        {D7455400-0386-11D0-AE19-00AA004B9986}
           = REG_SZ C and sample filter 
           InprocServer32
              = REG_SZ sampfilt.dll
 

Up through the entry for the class (CLSID\40A45370-0386-11D0-AE19-00AA004B9986), this is standard COM. The DLL sample.dll implements running object behavior for the .sam class. But note the extra entry, PersistentHandler. This entry specifies the class responsible for brokering requests to the persistent objects of the sample class. The entry under PersistentAddinsRegistered identifies the implementation responsible for the interface named 89BCB740-6119-101A-BCB7-00DD010655AF (IID_IFilter). Finally, we come to the class implementing IID_IFilter, and again the syntax is standard COM. InprocServer32 is loaded through the standard COM mechanism.

Pseudo-Persistent Handler Functions

Three functions are provided with Microsoft Index Server which are sufficient to instantiate IFilter for use by Microsoft Index Server. These functions are not a full implementation of COM persistent handlers. The three functions are:

SCODE LoadIFilter( WCHAR const * pwcsPath, IUnknown * pUnkOuter, void ** ppIUnk );
 
SCODE BindIFilterFromStorage( IStorage * pStg, IUnknown * pUnkOuter, void ** ppIUnk );
 
SCODE BindIFilterFromStream( IStream * pStm, IUnknown * pUnkOuter, void ** ppIUnk );
 

Each takes an object or object nam, a storage path and stream respectively, plus an optional controlling unknown and return an interface pointer bound to the IFilter interface. The latter two functions are especially useful when binding to the filter of an embedded object.

These functions are declared in the file ntquery.h and exported from query.lib.

Recommended Properties

The IFilter interface does not require that any particular property be exposed, but Index Server will take advantage of the existence of some properties. Filter writers are encouraged to expose the following properties. Exposing the same properties from multiple object formats allows the client of Index Server to make a common query across many (or all) types of an object.

The properties below are named by the format identifier of the property set, followed by either a number corresponding to the PROPID of the PROPSPEC for properties of type PRSPEC_PROPID or a string corresponding to the string name for properties of type PRSPEC_LPWSTR.

Title

F29F85E0-4FF9-1068-AB91-08002B27B3D9\2

The title property is the title property from the Microsoft® Office summary information property set. By default, this property is cached by the index server for quick retrieval. The HTML filter also exposes the title property.

Description

D1B5D3F0-C0B3-11CF-9A92-00A0C908DBF1\"DESCRIPTION"

The description property is exposed by the HTML filter. (Metadescriptions are not emitted by the sample HTML filter. It corresponds to the <META NAME="DESCRIPTION" ...> tag. If this property exists, it is used exclusively to generate the document abstract.

Other properties of type PRSPEC_LPWSTR in the same property set as the description property correspond to other HTML metatags with the equivalent name.

Office Summary Information

In addition to title, several other properties from the Microsoft® Office summary information property set may be useful. They are listed here following the PROPID.

F29F85E0-4FF9-1068-AB91-08002B27B3D9\2 (title)

F29F85E0-4FF9-1068-AB91-08002B27B3D9\3 (subject)

F29F85E0-4FF9-1068-AB91-08002B27B3D9\4 (author)

F29F85E0-4FF9-1068-AB91-08002B27B3D9\5 (keywords)

F29F85E0-4FF9-1068-AB91-08002B27B3D9\6 (comments)