How To Use Index Server to Sort Content That Is Tagged with Date Metatags by Content Management (279714)



The information in this article applies to:

  • Microsoft Site Server 3.0

This article was previously published under Q279714

SUMMARY

Microsoft Index Server queries to sort Site Server Content Store content with metatag date values do not yield the expected result. For example, the following Index Server query:

@ExpiresOnDate  >  99/09/22
					

to display content that contains the following metatag:

<meta name="Expiresondate" content="2000-01-02 12:00:00">
					

does not return the expected document.

This occurs because, by default, Index Server treats the dates as strings and cannot sort by date values. This article describes how you can configure Index Server to sort content that contains date metatag values by using an Internet Server Application Programming Interface (ISAPI) filter.

MORE INFORMATION

To configure Index Server to sort content with date metatag values, perform the following steps:
  1. Install and configure the sample HTML property ISAPI filter from the following Web site: This filter is designed to work with Microsoft Windows NT 4.0. The sample HTML property filter works in conjunction with Index Server's built-in HTML filter and converts meta property values from strings to datatypes that are specified in its configuration file.

    Place the sample HTML property filter configuration file (Htmlprop.ini) in the \Systemroot\System32 folder. This file should contain the following property definition for each metatag datatype that will be converted:

    metavalue (VT_FILETIME) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 metavalue
    							

    where metavalue is the actual metatag.

    This example uses the VT_FILETIME data format to convert a date metatag that is using the Index Server Date format (YYYY-MM-DD HH:MM:SS).
  2. After you install the sample HTML property filter, you must add property definitions to your Index Server pages to allow Index Server to store the associated property values in its index. These definitions tell Index Server that the HTML meta property, named metavalue, will be referred to as metavalue. The property is defined as a date and time value, and the long string of letters and numbers is the globally unique identifier (GUID), which uniquely identifies all HTML meta properties.
    • Add this property definition to the Query.idq file (which comes with Index Server) in the Names section:

      metavalue (VT_FILETIME) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 metavalue
      
      CiColumns=vpath,DocTitle,write,metavalue
      								

      where metavalue is the actual metatag.
    • Add this property definition to Query.asp, the Active Server Pages page that generates the IXSSO Query and comes with Index Server:

      Q.DefineColumn "metavalue (VT_FILETIME) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 metavalue"
      Q.Columns = "DocTitle, vpath, filename, size, write, characterization, rank, metavalue"
      								

      where metavalue is the actual metatag.
  3. You must add meta property values to Index Server's property cache to make them available for display as query results. To add meta properties to the property cache, perform the following steps:
    1. Open the Index Server Microsoft Management Console (MMC) administration tool, and then open the catalog.
    2. From the tree view, click Properties.
    3. Right-click the property that you want to add, and then click Properties.
    4. In the Properties dialog box, select the Cached check box. Use the VT_LPWSTR datatype, and set the default size to 4 so that Index Server manages the storage.
    5. In the tree pane, right-click Properties, and then click Commit to save the property cache changes.
  4. After you add the property to the schema of the property cache, each document is given a null value for the property. Because cache values are updated when a document is indexed, you must rescan the documents so that the values from each document are written to the property cache.

    To rescan a folder, open the Index Server MMC administration tool, and right-click the folder that contains your documents. Click All Tasks, and then click Full Rescan to force a full rescan of the files. After the index is updated, the meta property is available in the property cache.
  5. To generate date metatags with Site Server Content Management, add the following line of code to the SaveOLEProps function in the LibCM.asp include file:
    if (InStrRev(strFilename,"xls",-1,1)) Then Exit Function
    						
    LibCM.asp generates a stub file for the file extension in quotes. For Office documents, you must include multiple conditions as follows:
    if (instrrev(strfilename,"doc",-1,1))then 
    exit function
    elseif (instrrev(strfilename, "xls",-1,1)) then
    exit function
    elseif (instrrev(strfilename, "ppt",-1,1)) then
    exit function
    elseif (instrrev(strfilename, "mdb",-1,1)) then
    exit function
    else
    end if
    					
  6. When you create the Content type attribute to tag your documents with date values, you must use the "Generalized Time" format to create the attribute. The sample HTML property filter cannot properly convert date values if they are not in the Generalized Time or Index Server format (yyyy-mm-dd hh:mm:ss)

    To add other date formats and datatypes to the HTML property filter, you must modify the source code for the filter. You can access the source code from the following MSDN Web site:
  7. To query for documents within a given date range for a given metatag with a date value, use the following format:

    @metatag  >  YY/MM/DD and @expiresondate < YY/MM/DD
    							

    For example, to find all documents that have an ExpiresOnDate metatag value between June 30, 1999 and January 1, 2000, use the following query:

    @ExpiresOnDate > 99/06/30 and @ExpiresOnDate  <  00/01/01 
    						

NOTE: This article refers to an unsupported sample, Htmlprop.dll. For Windows NT 4.0-based systems, you can obtain this file from the following MSDN Web site: For Windows 2000-based systems, you must download this file as part of the Platform SDK, and the user must compile it. Microsoft does not provide a precompiled version for Windows 2000-based systems.

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbfix kbhowto KB279714