Using Index Server to Query and Display META TAG Information (185985)



The information in this article applies to:

  • Microsoft Index Server 2.0

This article was previously published under Q185985

SUMMARY

By default, you cannot include META information in query results from Index Server version 2.0. This article shows how you can both query META information and show this information in the result sets using Active Server Pages (ASP).

MORE INFORMATION

Step 1

  1. First the META information must be cached by Index Server. To do this, open the Index Server Management Console, and go to the property list for the content that has been indexed.

    If there are entries in the HTML document such as:
          <meta name="animal" content="Elephant">
     
    						
    Then in the Properties list there should be an entry for "animal" under the Property Column, with a Property set of:
          d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1
     
    						
    (The above is the globally unique identifier [GUID] for all META information.)
  2. Right-click this entry, and then select Properties.
  3. Check the option to cache this value. Set the Data Type to VT_LPWSTR. The default size should be acceptable for most string types.
  4. To commit these changes, right-click Properties in the left panel and select Commit.
  5. Re-scan the directories with the HTML files that have the META information required.

Step 2

  1. To build an ASP to use this information, you must first define a Column using Q.DefineColumn. This requires the GUID given above.
  2. To query just the META information, the query string must be preceded with @metaname (in this example @animal). This forces Index Server to query only the META information.

ASP Example

A sample ASP that uses this information follows. Remember to replace all incidences of "animal" with your own Meta Tag Name. Note that the Q.DefineColumn line is continuous with the line containing the GUID:
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 <%
 set Q = Server.CreateObject ("IXSSO.Query")

 Q.DefineColumn "animal (DBTYPE_WSTR) =
 'append to above    d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 animal"

    Q.Query = "@animal Elephant"
    Q.Columns = "animal"
    set RS = Q.CreateRecordSet("sequential")

 %>

 <title>Sample Search</title>
 </head>
 <body>
 <p>
 <%
 Do While Not RS.EOF
 %>
 <p>
 <b>Type of animal: </b><%= RS("animal") %>
 </p>
 <%
    RS.MoveNext
         Loop
 %>
 </p>
 </body>
 </html>
				

Modification Type:MajorLast Reviewed:4/30/1999
Keywords:kbhowto KB185985