Chapter 13. Running a CGI Search Tool

As a web site grows, offering full-text searching of its contents becomes increasingly important. It just isn’t possible (or desirable) to have a specific set of browseable links that will let every user find the content she is looking for.

SWISH (Simple Web Indexing System for Humans) is a freely available search tool, originally by Kevin Hughes, that has had a long history, featuring numerous incarnations. One of the current versions is SWISH-E, available from http://sunsite.berkeley.edu/SWISH-E/. This chapter demonstrates how to add keyword searching to a web site with SWISH-E and just a little bit of Perl CGI scripting.

The creation of this keyword-search capability will require a number of steps:

  1. Downloading the SWISH-E software source code and documentation.

  2. Uncompressing and expanding the downloaded SWISH-E source code and documentation.

  3. Compiling the SWISH-E source code to make an executable version of the program.

  4. Running the compiled SWISH-E program from the command line to create an index file.

  5. Creating a Perl CGI script that can run the SWISH-E program to retrieve a set of results matching a set of search terms, then formatting and returning those results to the web user.

Downloading and Compiling SWISH-E

Within a few clicks of the SWISH-E home page is a downloads section where one can obtain the latest version of the software. At the time of this writing, that was ftp://sunsite.berkeley.edu/pub/swish-e/swish-efiles.1.3.2.tar.gz ...

Get Perl for Web Site Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.