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 Telnet or SSH 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.
-
Create a SWISH-E configuration file for your Virtual Private Server. You may copy or edit the following sample configuration files to meet your needs:
-
FreeBSD & Solaris [SWISH-E 2.0.5]
A sample configuration file can be found on your server in the following location:~/usr/local/swish-e-2.0.5/conf/user.config
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.
-
-
To create a Web site index, run the swish-e program like this (substituting the name of your SWISH-E configuration file you created in the previous step for CONFIG_FILE):
-
FreeBSD & Solaris
The command to run swish-e is as follows:% virtual /usr/local/swish-e/bin/swish-e -S http -c /usr/local/swish-e/conf/CONFIG_FILE
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 your 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 depending on your Virtual Private Server O/S
-
FreeBSD & Solaris
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 Telnet or SSH prompt, 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_. Feel free to modify these functions such that the CGI outputs pages that are in synch with the motifs of the rest of your site.
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!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771