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! |
You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. FREE! Go There Now!
|
|
|
|
Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan. FREE! Go There Now!
|
|
|
|
Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base. FREE! Go There Now!
|
|
|
|
Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right." 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!
|
|
|
|
Rational Build Forge Express Edition is an automation framework that packages the latest enterprise-grade technologies into a reliable, flexible and robust configuration designed and priced specifically for small to midsize businesses. The new Rational Build Forge Express eKit provides you with valuable resources – including a case study, podcast, demo, and articles – to help you increase staff productivity, compress development cycles and deliver better software, fast. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered! 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!
|
|
|
|
Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
|
|
|
|
The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |