Microsoft KB Archive/279714

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

Article ID: 279714

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Site Server 3.0 Standard Edition

-



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:



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:  Install and configure the sample HTML property ISAPI filter from the following Web site:

http://msdn.microsoft.com/library/techart/msdn_ismeta.htm

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). 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:

<pre class="fixed_text">Q.DefineColumn &quot;metavalue (VT_FILETIME) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 metavalue&quot; Q.Columns = &quot;DocTitle, vpath, filename, size, write, characterization, rank, metavalue&quot;

where metavalue is the actual metatag.</li></ul> </li> 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: <ol style="list-style-type: lower-alpha;"> Open the Index Server Microsoft Management Console (MMC) administration tool, and then open the catalog.</li> From the tree view, click Properties.</li> Right-click the property that you want to add, and then click Properties.</li> 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.</li> In the tree pane, right-click Properties, and then click Commit to save the property cache changes.</li></ol> </li> 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.</li>  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,&quot;xls&quot;,-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,&quot;doc&quot;,-1,1))then exit function elseif (instrrev(strfilename, &quot;xls&quot;,-1,1)) then exit function elseif (instrrev(strfilename, &quot;ppt&quot;,-1,1)) then exit function elseif (instrrev(strfilename, &quot;mdb&quot;,-1,1)) then exit function else end if                   </li> When you create the Content type attribute to tag your documents with date values, you must use the &quot;Generalized Time&quot; 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:

http://msdn.microsoft.com/library/techart/samples/5189.exe

</li> To query for documents within a given date range for a given metatag with a date value, use the following format:

<pre class="fixed_text">@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:

<pre class="fixed_text">@ExpiresOnDate > 99/06/30 and @ExpiresOnDate <  00/01/01

</li></ol>

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:

http://msdn.microsoft.com/library/techart/msdn_ismeta.htm

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.

Keywords: kbhowto kbfix KB279714

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.