How to use Index Server to make your site Searchable. Narrow your search when returning results

Contributed by
Rating: 3 stars3 stars3 stars3 stars3 stars / 10
October 20, 1999
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

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>

<body>

<form method="get" action="/directoryname/sitesearch.asp" id=form1 name=form1>
<!-- search text -->
<table width="100%">
<tr width="100%" bgcolor="Black">
<td width="100%">
<font color="White">
<b>Search</b>
</font>
</td>
</tr>
</table>
<input type="text" name="qu" size="20"><br>

<!-- max hits -->
<input type="hidden" name="mh" value=50>
<!-- sort by hits -->
<input type="hidden" name="sd" value="Hitcount">
<!-- allow enumeration -->
<input type="hidden" name="ae" value="1">
<!-- catalog -->

'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">&nbsp; <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>

 

blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials