This demo assumes you've already installed Option Pak 4.0 and installed the Index Server. The documentation provided my Option Pak 4.0 is very good. I've always wondered what this "INDEX SERVER" was that came with Option Pak 4. After reading the doc's and experiencing its power, its one of the most under-rated tools used! Also Chap. 18 of Pro. Active Server Pages 2.0 does a good job of explaining this.
Below is an example of the search page you can use to quickly make your site a searchable one! Thanks to the demo Stephen Wynkoop (http://www.swynk.com) provided it got me started. He goes into more detail of setting this up. I did this demo to provide how to use the "UTILITY" Object to provide scope to your search.
Also provided two documents that are in Option Pak 4 I found very useful. Below is a sample search page and results page with showing how to narrow the scope of your query using the "Utility Object" and the Methods "Deep" and "Shallow".
These documents are available in the Option Pak 4 documentation.
Click here for the List of Property Names -- These properties are always available for queries. Additional properties may also be available depending on the configuration of the Web server.
Click here for the Utility Object The utility object is an ActiveX server-side control, which means it is an automation object with a dual interface supporting IDispatch.
Page 1 A sample Search page
<html><head> <title>Index server search page</title>
'You'll have to change this text in red to where your index server catalog is stored. 'When you install Index server you'll be asked where your index directory is at <input type="hidden" name="ct" value="c:\inetpub\www07120\index\"> <input type="submit" value="Find It!" name="Search"> <a href="/directoryname/searchhelp.asp"><font size=-1>Help</a></font> </form>
Page 2 Results page
<XMP> <% 'Create a Query object, initialize it using SetQueryFromURL, and dump the object state 'Create the Object to store the query Set objQuery = Server.CreateObject("ixsso.Query")
'Create the object to use the Utility Object to narrow the scope of your query Set util = Server.Createobject("ixsso.Util")
'get the query properties set from the incoming URL (from the form GET operation) objQuery.SetQueryFromURL(Request.QueryString)
'tell the object what columns to include objquery.columns="filename,vpath,DocTitle,characterization"
'Using the Utility Object to narrow the search. You have 2 methods you can narrow your search 'Shallow only queries the documents listed in the directory provided. 'Deep does the directory listed and all sub-directories listed. This example used "Deep" util = objQuery, "/directoryName", "deep"
'open the recordset, causing the query to be executed set rsQuery = objquery.createrecordset("nonsequential")
'Now, if rsquery.eof is not TRUE, then we have results to show. 'If it IS TRUE, no results were found. get the page out for the user... %>
<h1>Search Results</h1> A maximum of 200 results will be returned, 20 hits per page will be shown.
<% if not rsquery.eof then Response.Write rsquery.recordcount & " hit(s) were found. " if rsquery.recordcount > 30 then Response.Write "You may want to refine your query." end if Response.Write "<br>" end if %> <% if not rsquery.eof then while not rsquery.eof and rowcount > 0 if rsquery("doctitle") <> "" then Response.Write "<p><b><a href='"" & rsquery("vpath") & "'>" & rsquery("doctitle") & "</a></b><br>" response.write "<font size=-1>" & rsquery("characterization") & "...</font><Br>" End if rowcount = rowcount - 1 rsquery.movenext wend Response.Write "<br><Br>" %> <% else %> <p>Sorry, no information was found. </p> <% end if %> </XMP>