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"> <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>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More ASP Code Articles
More By aspfree
developerWorks - FREE Tools! |
Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML. FREE! Go There Now!
|
|
|
|
As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
|
|
|
|
Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications. FREE! Go There Now!
|
|
|
|
Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial version of IBM Rational Business Developer V7.1. Rational Business Developer offers rapid and simplified development of business applications and services through Enterprise Generation Language (EGL) tools, generating Java or mainframe solutions while shielding developers from technical complexities. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms. FREE! Go There Now!
|
|
|
|
As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security. FREE! Go There Now!
|
|
|
|
As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |