Hit-Highlighting Syntax
Formatting Considerations
Sample Query
Adding a Highlight Hits Link to a Result Page
Errors
Files Used
When you query a document with Microsoft Index Server, the hit-highlighting feature shows you the exact portions of the document that satisfies your query (if any). The highlighting generates an HTML page containing a list of the hits, with those words making up the hit emphasized (by default, displayed in red and italicized). Each hit is displayed together with some of the text that surrounds it in the document. Also, for each document in which a hit is found, you are given a link to the full text of that document.
The hit highlighter (Webhits.exe) is a CGI executable file that you invoke from your browser. You must put it into a folder with execute access. Here is the syntax:
http://servername/Path1/Path2?Params
where
You specify Webhits parameters as
Param=Value[&Param=Value][&Param=Value]
This section lists and describes the parameters that can help you fine-tune a query with Webhits.
Format: CiRestriction=Query
You must always specify this parameter. The value must be a string, specifying the query for doing hit highlighting. The query string must be in escaped form, which means that spaces and other special characters have been converted to their respective ASCII codes. In an .htx file, the restriction can be escaped by using the EscapeURL keyword, as demonstrated in Adding a Hit Highlights Link to a Result Page.
Format: CiQueryFile=Physical path
This parameter is optional. If it is passed, CiQueryFile specifies the physical path of the .idq file containing the [Names] section describing the custom properties.You must pass this parameter for all queries involving custom properties. If you try to hit-highlight a document with a query that has a custom property and you do not specify the appropriate .idq file, the error message No such property will be displayed.
Format1: CiHiliteColor=24-bit color mask
The mask takes the form 0xHHHHHH, where each H is a hexadecimal digit.
Format2: CiHiliteColor=color
where name is any of {red, green, blue, yellow, black}. This parameter is optional. It specifies the color used to highlight the text matching the restriction. If it is not specified, or if the format used does not match either of the above, Webhits defaults to red.
Format: CiBold=value, where value can be any non-null string.
This is an optional parameter, that if present, specifies that the highlighted text be displayed in bold. Any non-null value will turn bold on.
Format: CiItalic=value, where value can be any non-null string.
This is an optional parameter, that if present, specifies that the highlighted text be displayed in italics. Any non-null value will turn italics on.
You can specify the Webhits parameters in any order, and you can include whitespace in any of the following places:
As a CGI application, Webhits relies on information stored in several CGI environment variables.
Putting together the information in the previous sections, suppose you want search for the author of a document greater than 100 bytes, and the authors name is George. To do that, send the following query:
@DocAuthor = George AND @size > 100
You want to aim your query at this document:
/Inetpub/Docs/Ideas.doc
The virtual path to Webhits.exe is
/Somepath/Webhits.exe ?
Webhits.exe resides on the server MyServer.
Before the query string can be passed to Webhits, it must be escaped, resulting in:
@DocAuthor%20%3D%20George%20AND%20@size%20%3E%20100
Now, to hit-highlight the document, issue the following command:
http://MyServer/somepath/webhits.exe/inetpub/docs/ideas.doc? CiRestriction=@DocAuthor%20%3D%20George%20AND%20@size%20%3E%20100
Note Neither @size nor @DocAuthor are custom properties, so you do not need to specify an .idq file in this case.
Webhits comes with ready-made result page (Queryhit.htx). This result page includes a link to Webhits for each document returned. To add a link to an existing page, modify the .htx file by inserting the following line where you want the link to appear:
<a href="http://<%
server_name%>
<vpath of webhits.exe><%
escapeURL vpath%
>? CiRestriction=<%
escapeURL CiRestriction%
>"><b>Highlight Hits</b></a><BR>
Here, server_name is a variable storing the name of the server on which Webhits.exe is located, and CiRestriction is the variable storing the query. You escape the restriction through the EscapeURL keyword, as shown in the sample query.
For a list of errors specific to the hit-highlighting feature, see Hit-Highlighting Errors on the Error Messages page.
Webhits uses query.idq, and installs the following files:
\Inetsrv\Scripts\Samples\Webhits.exe
\Inetsrv\Scripts\Samples\Queryhit.htx
\Wwwroot\Scripts\Samples\Queryhit.htm
© 1996 by Microsoft Corporation. All rights reserved.