Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
5.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright (c) 1998-1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: HtmlProp - Sample Filter Implementation
  11. //
  12. //--------------------------------------------------------------------------
  13. Description
  14. ===========
  15. The HtmlProp sample is an example IFilter implementation that specializes
  16. the Indexing Service (IS) HTML filter to extract value-type properties.
  17. It converts HTML meta properties to data types other than strings as
  18. specified by a configuration file.
  19. Path
  20. ====
  21. Source: mssdk\samples\winbase\indexing\HtmlProp\
  22. User's Guide
  23. ============
  24. * To build the sample
  25. 1. Set the Lib environment variable to "D:\mssdk\Lib;%Lib%" and the
  26. Include environment variable to "D:\mssdk\Include;%Include%",
  27. where D: is the drive on which you installed the Platform SDK.
  28. 2. Correctly set the CPU environment variable to, for example, "i386".
  29. 3. Open a command window and change the directory to the source path
  30. of the sample.
  31. 4. Build the filter DLL by entering, at the command-line prompt, "nmake".
  32. * To register the sample
  33. 1. Copy the filter DLL file HtmlProp.dll to your %windir%\System32
  34. directory.
  35. 2. Self-register the filter by entering, at the command-line prompt,
  36. "regsvr32.exe %windir%\System32\HtmlProp.dll".
  37. 3. Enable automatic registration of the filter by adding it, after
  38. the entry for nlhtml.dll, to the value MULTI_SZ DLLsToRegister in
  39. the registry under the following key.
  40. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex
  41. * To filter files using the sample
  42. 1. Update htmlprop.ini to specify data types for the HTML meta
  43. properties you have defined in your HTML files. Update your HTML
  44. files to contain properties that match the definitions. For examples,
  45. refer to the sample files htmlprop.ini, dog1.htm, dog2.htm, and
  46. dog3.htm.
  47. 2. Copy the file htmlprop.ini to your %windir%\System32 directory.
  48. 3. Copy the properties you defined in htmlprop.ini to your .IDQ file
  49. and/or update your .ASP script to define these properties.
  50. 4. Restart the CISVC service. If the files don't need to be filtered,
  51. touch files containing all of the meta properties added in the file
  52. htmlprop.ini and wait for them to be filtered.
  53. 5. Using the Indexing Service MMC snap-in, update the property cache
  54. to contain the properties you have defined. Be sure to choose the
  55. equivalent data type for each property or queries won't work.
  56. For example, DBTYPE_I4 is the same as VT_I4.
  57. 6. Force a full re-scan of all files and wait for the index to be updated.
  58. Note: Don't commit properties when scans are in progress. Wait for
  59. scans to complete. Index Server 2.0 has a bug that will cause your index
  60. to become corrupt. The bug is fixed in Indexing Service 3.0, in non-U.S.
  61. Index Server 2.0 versions, and in Windows NT� 4.0 Service Pack 4.
  62. You need to repeat steps 5 and 6 when your index is corrupt. Index Server
  63. 2.0 doesn't retain the list of properties in the property cache when your
  64. index becomes corrupt. Indexing Service 3.0, non-U.S. releases of Index
  65. Server 2.0, and Windows NT 4.0 Service Pack 4 actually remember the
  66. properties.
  67. * To query using the sample
  68. Issue queries using the properties and/or retrieve the values in their
  69. native types. The following are some sample queries using the sample
  70. files.
  71. @breedWeight > 10
  72. @breedOrigin = Australia
  73. @breedFirstBred = 1840
  74. Programming Notes
  75. =================
  76. The HTMLProp filter loads the default HTML filter (nlhtml.dll) and passes
  77. most of the processing to that filter. If the htmlprop.ini configuration
  78. file specifies that certain HTML meta properties should be converted into
  79. non-string data types, HTMLProp takes the string value from the HTML filter
  80. and coerces it into the desired type.
  81. This is useful because if htmlprop.dll is installed and properly configured,
  82. the following actions are possible.
  83. * You can query HTML meta property values using data types other than
  84. strings.
  85. * You can sort meta properties using native data types, rather than just
  86. strings.
  87. * You can retieve properties in .HTX/.ASP scripts in their native types,
  88. rather than as strings.
  89. HTMLProp supports the following data types.
  90. DBTYPE_UI1, DBTYPE_I2, DBTYPE_UI2, DBTYPE_I4, DBTYPE_UI4,
  91. DBTYPE_I8, DBTYPE_UI8, DBTYPE_R4, DBTYPE_R8, and VT_FILETIME
  92. By modifying htmlprop.cxx, additional data types can be supported, and
  93. additional date formats can be added. Currently, only the Indexing Service
  94. syntax is supported for date specifications.
  95. VT_FILETIME values can be in any time zone you like, but the .HTX file parser
  96. in Indexing Service assume all times are Coordinated Universal Time (UTC) and
  97. will be displayed as such.