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/.
To add SearchToHTML to your site, follow these directions:
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.")
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>
files: list of files to be searched, separated by commas or spaces.
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.
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.
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).
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.