Facebook

Installing Matt’s Simple Search Script

Here’s a nice script to implement a personal site search engine. Simple Search may not be the most efficient search tool on the internet according to its author, but it can sift through hundreds of documents and get the job done.

Installation Procedure

1. Locate and download the following files fromĀ Matt’s Script Archive:

search.pl – The Perl script performs search and reports findings.
search.html – The HTML file containing the form users fill-out.

2. Change the first line of the Perl script to reflect the official path to Perl on our server:

#!/usr/local/bin/perl

3. There are a few more things that need to be changed in the Perl script:

# Define Variables

$basedir = The system path to the directory with searchable files.
$baseurl = The URL to the base directory above.
@files = Array which includes the files you wish to search.
$title = The title of the generated search results page
$title_url = The URL to the directory containing search.html
$search_url = The URL to the search.html form.

The first variable calls for a system path which is not the same as a URL. If your domain name was yourdomain.com the system path would be /sites/<domain>/htdocs/ where <domain> is your domain name without “www”.

As such, the Set Variables section of the Links script would follow this format:

# Define Variables

$basedir = ‘/sites/<domain>/htdocs/files/’;
$baseurl = ‘http://www.yourdomain.com/files/’;
@files = (‘*.shtml’,’demos/links/*.html’,’demos/guest/*.html’);
$title = “Matt’s Simple Search”;
$title_url = ‘http://www.yourdomain.com/’;
$search_url = ‘http://www.yourdomain.com/search.html’;

The first and second settings above suggest that the searchable files reside in a subdirectory called files. Be sure to substitute your domain name in the example above.

4. Upload the “search.pl” script to your cgi-local directory in ASCII transfer mode. Make sure your permissions setting for this file is 755 -rwxr-xr-x

5. Modify the form ACTION attribute within “search.html” to reference the search script within cgi-local as shown below and upload to your root (“home”) directory.

<FORM METHOD=”POST” ACTION=”/cgi-local/search.pl”>

You can test the script by referencing the links.html file via the web.

Special Notes