Export (0) Print
Expand All

SmpFilt Sample

Note  Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.

The SmpFilt sample is an example IFilter implementation that reads an unformatted text file (with the extension .smp), using the ANSI code page of the current thread, and outputs UNICODE text for the current locale. It accepts as input only single-byte-character text files and not multibyte-character or UNICODE text files. It is the simplest sample of an IFilter implementation included in the Indexing Service sample code.

Source: mssdk\samples\winbase\indexing\smpfilt\

ms692500.wedge(en-us,VS.85).gifTo build the sample

  1. Set the Lib environment variable to "D:\mssdk\Lib;%Lib%" and the Include environment variable to "D:\mssdk\Include;%Include%", where D: is the drive on which you installed the Platform SDK.

  2. Correctly set the CPU environment variable to, for example, "i386".

  3. Open a command window and change the directory to the source path of the sample.

  4. Build the filter DLL by entering, at the command-line prompt, "nmake".

ms692500.wedge(en-us,VS.85).gifTo register the sample

  1. Copy the filter DLL file SmpFilt.dll to your %windir%\System32 directory.

  2. Self-register the filter by entering, at the command-line prompt, "regsvr32.exe %windir%\System32\SmpFilt.dll".

  3. Enable automatic registration of the filter by adding it to the MULTI_SZ value of the DLLsToRegister entry in the registry under the following key.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex

ms692500.wedge(en-us,VS.85).gifTo filter files and submit queries using the sample

  1. Create one or more files to filter. For example, copy the source file SmpFilt.cxx to a file named SmpFilt.smp.

  2. Restart the cisvc service. Touch the .smp files and wait for Indexing Service to filter them.

  3. Formulate queries that you know will succeed on the .smp files and submit them using the Indexing Service MMC snap-in or one of the sample query programs in the Platform SDK.

Programming Notes

The SmpFilt sample illustrates the basic structure of a filter. It minimally implements the methods of the IFilter and IPersistFile interfaces. Because the SmpFilt sample does not filter any value-type properties, the implementation of IFilter::GetChunk does not process properties other than "contents," and IFilter::GetValue always indicates no values. For examples of how to filter value-type properties as well as text, refer to the IFilter Sample (HtmlFilt) or the HtmlProp Sample in the Platform SDK.

Error-handling in the SmpFilt sample is rudimentary. The sample handles only the most obvious error conditions. Comments in the source code list all the standard result codes and indicate whether they are implemented. If you use SmpFilt as a basis for your own filter, carefully determine the additional error conditions that you need to detect and handle.

 

 

Build date: 9/10/2012

Community Additions

ADD
Show:
© 2014 Microsoft