Last Updated: January 20, 2000
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. The configuration of web indexing and searching is presented in three sections below.
SWISH-E is an enhanced
version of SWISH, which was
originally written by Kevin Hughes. SWISH-E stands for Simple Web
Indexing System for Humans - Enhanced. With it, you
create searchable indexes of files on your Web server--and let people browsing
your site search the generated indexes. Although SWISH-E is not intended to be
a full-featured indexing and search tool, it is quite easy to manage, is
incredibly powerful for being so simple, and was specifically created for use
with Web sites.
To create a SWISH-E index of your site:
cd (and hit return - this will put you in your
home directory)
tar -xvf /usr/local/contrib/swish-e.tar
cd ~/usr/local/swish-e
| PLEASE NOTE: You should be very familiar with the FileRules section of the configuration file. By default, SWISH 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- comment out that FileRules line by placing a "#" as the first character in the line. |
cd
~/usr/local/swish-e
./swish-e -c CONFIG_FILE
Where CONFIG_FILE is the name of your SWISH configuration file you created in the previous step.
After 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 configuration file.
The HTML source below represents a sample search form. This form can be customized for your Virtual Server by simply changing the occurrence of SWISH_INDEX_FILE (shown in bold) to the name of the swish-e index which you specified as the value for the IndexFile variable in the SWISH configuration file.
<html>
<head>
<title>Search Swish Index</title>
</head>
<body>
<h1>Search Swish Index</h1>
<form method="GET" action="/cgi-bin/library/searchindex/query.pl">
<!-- want to mimic "swish -f swishindex -w keywords -m maxresults" -->
<input type="hidden" name="swishindex" value="/usr/local/swish-e/SWISH_INDEX_FILE">
<b>Search for the following keywords:</b><br>
<input name="keywords" size=40 maxlength=512> <p>    
<input type=radio name=detail value=yes CHECKED> <b>Verbose report</b>    
<input type=radio name=detail value=no> <b>Simple report</b>
<p> <b>Maximum number of results:</b><br>
<input name="maxresults" size=5 value=40 maxlength=64> <p>
<input type="submit" value="Search">
<input type="reset" value="Reset">
<p> __________________________________________<p>
search example 1: john and doe or jane<br>
search example 2: john and (doe or jane)<br>
search example 3: not (john or jane) and doe<br>
search example 4: j* and doe<br> <p>
</form>
</body>
</html>
You may hide the "maxresults" edit field by simply using a "type=hidden" argument with the input tag.
If you are unfamiliar with the FORM HTML element, or would like to learn more about forms, the following URL is an excellent resource:
http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/fill-out-forms/overview.html
To install the search form on your Virtual Server you will need to do the following:
The CGI source code for the search form was installed when you created your SWISH-E index file. To extract only the CGI scripts from the swish-e tar archive, perform the following commands:
print_header_info and
print_footer_info. 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. Once you have completed the installation successfully, you will have a working search form like the one shown below (go ahead and test it).
Copyright © 1996-2000. Last Modified: 20 January 2000. A Little Technology Shoppe, LLC. All rights reserved. All brand names and product names used on these web pages are trademarks, or trade names of their respective holders.