SearchToHTML ReadMe

August 17, 2000
[The Parameters]

Introduction

The SearchToHTML applet provides visitors to your homepage with a simple way of searching your site. The compact search applet sends the search results onto a JavaScript to be displayed as HTML. The August 17, 2000 release of the applet slightly improves the efficiency of searches and expands and corrects the applet's documentation. For more information on the modifications to the source code, see the individual source files. (Since the May 12, 2000 release of the applet, the following parameters have been added: leadingcontextlength, trailingcontextlength, xhtml_chkbx_checked, exact_chkbx_checked, and max_num_matches.)

The SearchToHTML applet is based on the AdvSiteSearcher applet. Using HTML to display the results (rather than a list within the applet) has made it possible to add three new features to the search results (not available before because of display space concerns): the match context (some of the words surrounding the match), the nearest anchor to the match (so that the visitor doesn't have to scroll as much), and the title of the page (if it is encountered before a match).

This applet is distributed as linkware for The Gilbert Post. Each site that uses the applet must include a link to The Gilbert Post, http://www.geocities.com/gilbertnews/.

Adding SearchToHTML to your site

To add SearchToHTML to your site, follow these directions:

1. Upload the required files to the same directory as the HTML file that will display the applet. The required files are:
(These should have been included with this document. The spelling and case of the class file file names are significant. The applet will probably not even load if you change these file names.)

2. Paste the following code into the page where you want the applet to appear:

3. Change the pasted code to fit your needs. The "file" parameter is required. Change its value to be a list of files separated by commas or spaces. (The file names should be relative to the page on which the applet is displayed. For example, if the applet were on "http://www.BBB.com/index.html" and you wanted "http://www.BBB.com/cool.html" to be searched, you would add "cool.html" to "files.")

A few notes

Changing the style of the search results

The applet encodes the search results and sends them onto a JavaScript found in searchresults.html. If you would like to change the display of the search results, you'll need to modify searchresults.html. If you're interested in changing the text of the search results, look under the heading "Text used in search results messages:" in the source of searchresults.html. If you're interested in leaving out the closest anchor, document info, or context from each search result, then look under the heading "Which elements should be displayed along with the results?"

Capability, compatability, and contact info

This version of SearchToHTML does not support Boolean expressions or wild card searches. (These features are under active investigation.) When a visitor enters a search phrase, the applet divides the phrase into tokens and searches for each token individually. If a match for a token is found in a document, that document is added to the list of matches (equivalent to a Boolean "or" search). The order of the documents in the search results is non-deterministic.

If you experience any problems with the applet or have suggestions, please e-mail gilbertnews@hotmail.com. However, the SearchToHTML applet is distributed without warranty or guarantee. Use it at your own risk.

SearchToHTML uses only the APIs of JDK 1.02 so it should run under all "Java-enabled" browsers. (If it doesn't run because of a compatibility error, please report the problem.) SearchToHTML's source code is included with this distribution. Send your questions or comments on the source to gilbertnews@hotmail.com.

Contact: David Faden <gilbertnews@hotmail.com>

Parameters guide

<param name="[name]" value="[value]"> (The [name] is case insensitive.)
See the source code of paramex.html.

Required

files: list of files to be searched, separated by commas or spaces.

Optional

target: name of frame for the search results to be displayed in. Defaults to "_top".
waitforall: set to true, the applet will not send HTML until all the documents (from "files") have been searched. By default, waitforall is set to false unless the target parameter is set to "_self" or "_top" in which case waitforall is always true.
startwords: words to be displayed in the search box on the first appearance.
max_num_matches: the maximum number of matches that will be reported. The default value is the number of documents to be searched.
leadingcontextlength: how many characters previous to (and including) the match should be displayed. Defaults to 15.
trailingcontextlength: how many characters following the match should be included in the context displayed in the search results. Defaults to zero.
resultspage: the name of the file containing the JavaScript to decode the search results; defaults to "searchresults.html"
xhtml_chkbx_checked: set this parameter to "true" to initially check the "Exclude HTML" (or equivalent) checkbox.
exact_chkbx_checked: set this parameter to "true" to initially check the "Exact matches only" (or equivalent) checkbox.

Change the colors

bgcolor: the background color of the applet.
fgcolor: the foreground (text of labels) color.
buttonbgcolor: the background color of the buttons.
buttonfgcolor: the foreground color of the buttons.
checkboxbgcolor: the background color of the checkboxes. (The effect varies across platforms.)
checkboxfgcolor: the foreground color of the checkboxes. (The effect varies across platforms.)
searchboxbgcolor: the background color of the search box.
searchboxfgcolor: the foreground color of the search box.

Change the text

searchbox_label_txt: the text next to the search box.
search_btn_txt: the text of the button that starts a search.
stop_btn_txt: the text of the button used to stop a search.
exact_chkbx_txt: the text of the check box used to specify exact matches only.
xhtml_chkbx_txt: the text of the check box used to specify whether HTML should be ignored.

Colors

The following colors are available by name: black, green, blue, darkblue, lightblue, cyan, darkgray, gray, lightgray, magenta, orange, pink, red, white, and yellow.

If the SecurityManager allows it, you may also try to get System (property) defined colors.

Colors may also be defined as hexadecimal strings (beginning with "#" as in HTML).



Linkware Agreement: You will maintain a prominent link to The Gilbert Post (http://www.geocities.com/Athens/Parthenon/1911/) or http://www.geocities.com/gilbertnews/ if you include the SearchToHTML applet or a variant on its code on your site. (Please also leave our spiel on the search results page.) Other than this, the applet is free.

Have fun!

SearchToHTML © 1999 - 2000 David Faden for The Gilbert Post

The Gilbert Post is an independent student paper serving Gilbert High School of Gilbert, Iowa, and the world (hopefully). It was founded because at the time (and at present) there was no official school paper, a chasm that needed to be filled. By adding the SearchToHTML applet and a link to us to your page, you are helping The Gilbert Post. Thank you.