Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


July 2001

The Win2K Indexing Service, Part 2

RSS
Subscribe to Windows Web Solutions | See More Active Server Pages (ASP) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

Using the Query Helper API in ASP to put Indexing Service into action

[Author's Note: Each month, this column discusses various aspects of the advanced administration of e-business sites. Last month, I examined the setup, configuration, and implementation of Windows 2000 Indexing Service 3.0. This month, I show you how to put Indexing Service to use with a simple, customized Active Server Pages (ASP) application that provides powerful search capabilities.]

Last month, I introduced you to Indexing Service and showed you how to set it up and configure it. This month, I show you how to customize a sample ASP application that uses the Query Helper API to put Indexing Service into action.

Indexing Service provides content indexing of Web site content and file-system content, a feature that separates Indexing Service 3.0 from its Windows NT 4.0 predecessor, Index Server. Indexing Service can extract text and property information from files on both the local host and remote, networked hosts. With Indexing Service, you can use custom search pages to create Web applications.

Indexing Service requires Win2K Professional, Win2K Server, Win2K Advanced Server, or Win2K Datacenter Server. For the examples I provide here, I assume that you have access to Win2K Server, Win2K AS, or Datacenter and have performed a default installation, which includes installation of IIS 5.0 and Indexing Service 3.0.

Indexing Service APIs
Before I show you how to create custom search pages, let me briefly discuss the APIs available to Indexing Service. Many programming languages have several APIs that communicate with Indexing Service. You or your developers can choose the API that's most applicable to your environment and experience. When choosing an API, you must balance programming complexity with application performance. In the most general terms, the OLE DB Provider API is the most difficult API to program. APIs that encapsulate the OLE DB Provider (e.g., Admin Helper, Query Helper) are easier to program, but they're less flexible and slower to execute. Consequently, the OLE DB Provider API is the fastest and offers the greatest flexibility. Later in this article, I show you how you can easily implement the Query Helper API in a simple ASP application. Table 1 summarizes the APIs available for Indexing Service.

Using the Sample Search Applications from the SDK
The Win2K Platform software development kit (SDK) has fantastic developer documentation and sample applications that provide everything you need to start writing custom search applications for Indexing Service. After you've installed the Platform SDK, you can install the sample search applications by navigating to \program files\microsoft platform sdk\samples\winbase\indexing\iissearch. Double-click install.bat. The installation command file copies many .html files and ASP applications to your \%systemdrive%\inetpub\iissamples\issamples folder. (You can also download query.asp from the Code Library on the IIS Administrator Web site at http://www.iisadministrator.com.) After you've installed the SDK, run Microsoft Internet Explorer (IE) or any other browser, then navigate to the sample Indexing Service application at http://localhost/iissamples/issamples, which Figure 1 shows.

Notice in the left pane of your browser's window that the sample application is more than just one ASP application. In fact, there are six different sample applications:

  • Query.asp—This simple ASP sample is written in server-side VBScript and client-side JScript (Microsoft's implementation of JavaScript) that uses the Query Helper API to execute Indexing Service Query Language queries. I explain this application and show you how to implement it later in the article.
  • Query.htm, query.idq, query.htx—This .htm, Internet Data Query (IDQ), and HTML Extension files (HTX) sample uses the Internet Server API (ISAPI) Extensions API.
  • Fastq.htm, fastq.idq, fastq.htx—This optimized IDQ and HTX example uses the ISAPI Extensions API.
  • Sqlqhit.asp, sqlqhit.htm—This simple ASP sample is written in VBScript and illustrates how to use the OLE DB Provider for Indexing Service API to execute queries.
  • Advquery.asp—This advanced ASP sample is written in VBScript and JScript and illustrates how to use the Query Helper API with server-side scripting to execute Indexing Service Query Language queries.
  • Advsqlq.asp—This advanced ASP sample is written in VBScript and JScript and illustrates how to use the ADO and Query Helper APIs with server-side scripting to execute SQL scripts on Microsoft SQL Server.

A simple HTML page called default.htm manages all six applications and provides easy access to each sample. You can easily modify and customize any of these sample applications for integration into your Web applications. Equally as important, each of these applications stands alone (i.e., can be called directly) without the default.htm menu application, which makes copying the code and integrating it into your Web applications simple.

Customizing Query.asp
To begin creating your custom search application, create a virtual directory or folder on your IIS 5.0 Web server to house your Indexing Service ASP search application. (I created a folder at \inetpub\wwwroot\search, created a virtual directory called Search under the Default Web site, then mapped to the \search folder.) Default access permissions are sufficient. Copy the query.asp application file and its supporting .htm Help files and images (i.e., query.asp, is2foot.inc, ixtiphlp.htm, ixqlang.htm, rankbtn1.gif through rankbtn5.gif, hilight.gif) to the Search folder. To test whether the ASP application functions correctly, follow these steps:

  1. Open a browser.
  2. Navigate to and run query.asp, as Figure 2 shows.
  3. Run a search. (I searched for Platform SDK.)
  4. View the results of the successful search.

Notice that the image on the query.asp page is a broken link. I show you how to replace that image with a custom image later.

   Previous  [1]  2  Next 


Reader Comments
Thank you for providing the information in Parts 1 and 2.
Your examples in combination with the SDK made it quick and easy to build an Intranet search.

Are there any legal considerations using your query.asp or the samples that MS provides in the SDK on a company Intranet?

Thanks again!

Steve Wolf November 11, 2002


is this search page available in the aspx - net format

keith scharding February 11, 2004


When you reference a previous article, there should be a link to that article!

Dan C May 19, 2004


I agree with Dan C. There should definitely be a link to Part 1.

Here it is:
http://www.windowsitpro.com/Article/ArticleID/20593/20593.html

Anonymous User September 08, 2005 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

How can I stop and start services from the command line?

...


Related Events Delivering Reliable and Effective Web-Based Applications

Making Web Application Perform Better: What to Watch, How to Watch It, and How to Fix It

Check out our list of Free Email Newsletters!

IIS and Web Administration eBooks Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing