A convenient method to allow clients to retrieve information from a web site is by building an index of the web pages and providing search capability. This may seem like a daunting task, but with a few tools this task becomes very easy.

Normally web indexing and searching requires a complex, hard to use and install WAIS-based solution, however a small yet powerful program SWISH-E, (which is based on SWISH written by Kevin Hughes), can be used to fulfill your web indexing and searching needs.

Installation

To install SWISH-E on your Virtual Private Server, connect via SSH, su to root, and run this command:

# vinstall swish-e

NOTE: Swish-e requires the Perl LWP module to run.

Usage

To use SWISH-E, do the following.

  1. Create a SWISH-E configuration file for your Virtual Private Server. You may copy or edit the sample configuration files to meet your needs. A sample configuration file can be found on your server in the following location:

    ~/usr/local/swish-e-2.0.5/conf/user.config
  2. Make sure you change all occurrences of LOGIN_NAME in the files to match the login name of your server. Other modifications may also be necessary. You should become familiar with the FileRules section of the configuration file. By default, SWISH-E will not index files in directories containing a .htaccess file. If you have a directory that contains a .htaccess file, and would like it indexed, then comment out that FileRules line by placing a # as the first character in the line.

    NOTE: Create a separate configuration file for each search on your Virtual Private Server. For example, if you have several users on your server that require separate searches for their own directories, create a separate configuration file for each user. Then use the configuration files to create separate index files for each search.


  3. To create a Web site index, run the swish-e program like this:

    # virtual /usr/local/swish-e/bin/swish-e -S http -c /usr/local/swish-e/conf/CONFIG_FILE
  4. When you run the SWISH-E executable, a SWISH-E index file will be generated. The name of the SWISH-E index file is that which you specified as the value for the IndexFile variable in the SWISH-E configuration file.

The Search Form

To install the search on your web site you will need to download the Search Form and store it somewhere in your usr/local/etc/httpd/htdocs directory structure. Feel free to customize the form, add graphics, etc., but be sure that the variable name for each input field is not altered.

The form can be customized for your Virtual Private Server by simply changing the occurrence of SWISH_INDEX_FILE to the name of the swish-e index which you specified as the value for the IndexFile variable in the SWISH-E configuration file. You may hide the maxresults field by simply using a type=hidden argument with the input tag.

The Search CGI

The CGI for SWISH-E needs to be modified:

The CGI script is installed into your www/cgi-bin/ directory with the name search.pl.sample. You will need to change the filename to search.pl and make it executable. From the SSH, su to root, and run the following commands:

# mv search.pl.sample search.pl
# chmod 655 search.pl

You can customize the appearance of the search CGI, if you wish. Two subroutines in the ~/www/cgi-bin/search.pl file, print_header and print_footer are used to print out header and footer information. You can find these by searching for the string MODIFY ME in the script. You can then insert whatever HTML you want between the line print <<_HTML_; and _HTML_.

More Information

For more information and documentation see:

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771