CGI Scripts: Simple local search
The Search CGI is a simple search. It will walk through directories
you've specified as searchable. It reads each HTML file on each
invocation and looks for the items the user has asked to be searched
for. The output of the search CGI is a list of URLs referring to
the web pages in your site that were found to have information the
user wanted. No index is made. The search does not link to any Internet
search engines. The idea is to keep it simple.
To use the search CGI, you will need to create a web page with
the appropriate input fields and hidden options and link this form
to a web page on your site. Users can then search your site for
information they desire.
Note to corporate clients: It seems that corporate clients
cannot use this script to effectively search their site. We are
currently working on rectifying the situation. In the meantime,
corporate clients should use their own search scripts, Matt's
script archive is a good place to start.
Download the sample HTML files
The next step is to download and save locally the sample
search HTML file. You can use this as a base for your own search
web page or as a guide on how to modify your existing search page.
All you need to do is edit the file and upload it to your web site,
or recreate the form on your existing search page.
Fields
The search script relies on visible and hidden HTML form tags to
get the necessary information to perform the search of your site.
The following table provides a list of the required tags for the
search form. Click on a tag name to view a detailed description
and syntax for that tag.
| Tag Name |
Type |
What it does |
| terms |
visible |
Words that the search CGI will look for |
| boolean |
visible |
Boolean operation to the individual terms or search items
in the terms field. Should be a select list. Valid options
are OR and AND in uppercase. |
| case |
visible |
Determines whether the search is case sensitive or insensitive.
This tag should be a select list. Valid options
are Insensitive and Sensitive. |
| user |
hidden |
Your user id or username. This should be in the user@
format. |
| files |
hidden |
This is a comma separated list of files and directories that
this CGI will search. |
| title |
hidden |
This defines the name and title of the search results page. |
| title_url |
hidden |
This provides a link back to a page on your site from the
results page. |
| search_url |
hidden |
This is the URL that sends the user back to the search page. |
Details
terms
This is a visible tag that allows the user to enter words that
the CGI will search for.
Syntax: <input type=text name="terms">
[ top ]
Boolean
This tag is a logical operator that searches for pages containing
all of the words entered in the terms field
when set to AND. The CGI will search for pages that contain any
of the terms when it is set to OR.
Syntax:
<select name="Boolean">
<option>AND
<option>OR
</select>
[ top ]
case
This is a visible tag that gives the option of selecting a case
sensitive or case insensitive search. The spelling is Sensitive
and Insensitive is important. They must be spelt exactly
as shown with the uppercase first letter.
Syntax:
<select name="case">
<option>Insensitive
<option>Sensitive
</select>
[ top ]
user
All tags for the search are required, however, if this tag is missing,
the search CGI will present the user with an error. Specify your
user ID or username in the user tag. This would be
in the form of username@ .
Syntax: <input type=hidden name="user" value="foo@">
files
With this option, you have the ability to control which files and
directories of your web site you wanted searched. The tag is a comma
separated list of files and/or/ directories. Only these files and
directories will be searched. Binary files (such as .jpg images)
will be ignored.
Syntax: <input type=text name="files" value="file1.html,path1,path2">
Globalserve Customers: If your website resides in /web_site/public_html,
make sure that you specify ~/web_site/public_html as the base value
for this tag.
[ top ]
title
The content of the title tag is used in two places on the results
web page It is used in the header <title> tag, and as the
"return" or "go back" link. We recommend this
tag be used to reference the name of the web page which called the
search page, such as the name of your web site
Syntax: <input type=text name="title" value="Return
to Home Page">
[ top ]
title_url
The title_url is used to provide a link back to your home page,
or to another page of your choice. Logically , this would be the
page that called the search engine page. It is used along with the
title tag to create a link. The CGI will build
the link as <a href=title_url>title</a>
Syntax: <input type=hidden name="title_url"
value="http://www...">
[ top ]
search_url
In order to get back to the search web page, the search CGI provides
a link that returns to the search page, if this tag is defined.
This should be the complete URL of the search page.
Syntax: <input type=hidden name="search_url"
value="http://www.../search.html">
[ top ]
|