As was described in the previous article, each search result contains a number of column properties. These contain information about each search result. In the previous article, the properties used were: FileName, doctitle, Size, Create and Characterization. As will be described below, each of these can be used to provide useful information in search results pages.
Hyperlinking the search result's filename
The FileName column property contains the search result's filename (e.g. default.htm). However, a more useful column property is vpath, which also contains the file's path as well as its filename (e.g. /financial/reports/june2002/default.htm). Once the file's path is know, it is straightforward to hyperlink the search result's URL using something like the following:
Const SERVER_URL = "http://www.brettb.com"
Response.write "URL: " & SERVER_URL & oRS("vpath") & "
"
A common convention when presenting search results is to hyperlink the document's name to its URL. Index Server uses the doctitle column property to store the document's name):
Const SERVER_URL = "http://www.brettb.com"
Response.write "URL: " & oRS("doctitle") & "
"
Displaying the search result's file size
The Size column property contains the size of the file in bytes. A small formula can be used to display the file's size in Kilobytes, which is often a better unit of measure for file sizes:
Response.write "Size: " & Round(CInt(oRS("Size"))/1024, 1) & "K
"
Displaying the document creation and modification dates
The creation and modification date and time for files are contained within the Create and Write column properties, respectively. These can be formatted to display a more user friendly date by use of the FormatDateTime VBScript function as shown below:
Response.write "Create: " & FormatDateTime(oRS("Create"), 1) & "
"
Response.write "Write: " & FormatDateTime(oRS("Write"), 1) & "
"
Further document properties
A number of other document properties may be of interest, such as HitCount (the number of words matching the query that were found in the file), and Rank (how closely the file matched the query). A more detailed description of the Rank column property is in the following section.
A complete listing of column properties is available here (it is also available in the IIS 4.0 documentation). Many properties are only of relevence if Microsoft Office documents are being indexed. Remember that if you wish to use any additional columns then they must be listed in the Columns property of the Index Server Query COM component, e.g.
oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size, Rank, Create, Characterization, HitCount"