SWISH-E Keyword Search Applet
SWISH-E   This package provides an offline keyword search capability in a Java applet. The applet reads an index file produced by the SWISH-E index engine into the web browser's memory and allows you to perform one or more keyword searches using that index. The search result is HTML formatted and displayed using JavaScript in a seperate result frame.

If you need a keyword search on a CDROM or similar medium without having access to a web server, i.e. without capability to execute a CGI script, then this package might be right for you.

Demonstration   See the applet in action on its javadoc.

Download   Applet source code (swishej.zip about 184 kByte).

JAR archive (swishej.jar about 34 kByte).

View the change log.

How to use the applet  
  1. Setup a frameset for the keyword search, e.g.

    <frameset rows="50,*">
    <frame src="srchappl.htm" name="searchapplet"
    scrolling=no border=0
    noresize frameborder=0 framespacing=0
    marginwidth=0 marginheight=2>
    <frame src="srchhelp.htm" name="results"
    frameborder=1 border=1
    framespacing=0 marginwidth=4 marginheight=4>
    Sorry, this browser does not support frames.
    No search capability provided.

  2. Setup the applet frame (named searchapplet in the example above), e.g.

    <applet code="swishej.SearchApplet" archive="swishej.jar"
    width=540 height=38 MAYSCRIPT align=top hspace=0 vspace=0
    alt="Please enable Java and JavaScript in your browser.">
    <param name=indexfile value=index.swish-e>
    <param name=resultframe value=results>
    <param name=helpfile value=srchhelp.htm>
    SWISH-E Keyword Search Applet.

    				Use the charmap applet parameter if your indexed data is not encoded in ISO-8859-1 character set.

  3. Make the SWISH-E index file and specify it as applet parameter indexfile. See my example SWISH-E configuration file.
  4. Setup the help document as shown in the helpfile applet parameter.
  5. Place the frameset, the applet and help documents, the GIFs from the ZIP archive, and the applet code (swishej.jar) in the root of your browsable and searchable area.
  6. Of course, add a reference to the frameset to the toplevel document of the browsable area in order to enter the keyword search.


Applet parameters  
String specifying the frame name for displaying the search result.
URL specifying the index file to be loaded. The usual Java security rules apply.
URL specifying the help file to be displayed when the Help button is pressed. That URL is displayed in the result frame.
String specifying the keyword entry label. If not specified the default is "Keywords:". If specified as empty string, no label is drawn.
String specifying the search button label. If not specified the default is "Search". If specified as empty string, no search button is drawn.
String specifying the words button label. If not specified the default is "All Words". If specified as empty string, no words button is drawn.
String specifying the clear button label. If not specified the default is "Clear". If specified as empty string, no clear button is drawn.
String specifying the help button label. If not specified the default is "Help". If specified as empty string, no help button is drawn.
String representing 8 bit to unicode mapping. If not specified the default is a 1:1 mapping for ISO-8859-1 (Latin 1). Example for ISO-8859-2:
      <param name=charmap value="


  • A Java and JavaScript enabled web browser. I tested the applet with Netscape's Communicator 4.5 and 4.61 on Linux and Windows NT and with M$ Internet Explorer 4.0 on Windows NT.
  • JDK 1.1 if you intend to hack the java sources. Setup your CLASSPATH to Netscape's java40.jar in order to resolve the JavaScript package dependency when compiling.
  • The SWISH-E 1.3.2 sources to produce index files. You must compile it without #define SUPPORT_DOC_PROPERTIES (see limitations below).


  • Document properties as implemented in SWISH-E 1.3.2 are not supported since their representation in the index files is unfortunately not platform independent (byte order issues).
  • It is no good idea to have a very large index file (e.g. 20 MB) since the index file is kept in-core. This requires careful setup of the swish-e configuration in order to get a useful but reasonable small (say at most 1-2 MB) index file. The applet tries its best not to eat up memory by gzip'ing the index file in chunks of 64 kB and working only one one gunzip'ed chunk at any one time.


  • In Netscape's Communicator 4.5 (Linux) the applet is not able to get the JavaScript window object to its Communicator container window when it is restarted from a HTML reference from the result frame. To exercise this problem, use the keyword "help", then activate the hit for the document "SWISH-E Based Keyword Search Applet", lastly activate the "in action" link. M$ Internet Explorer 4.0 definitely does not have this problem.
  • If you see "JavaScript Error; can't continue" in the applet's area using Netscape, then check the Communicator version. According to Netscape, version 4.6 has a broken LiveConnect (Java-JavaScript interface) and you should update to Communicator 4.61.


Copy.*t   Copyright (C) 1999-2001 Christian Werner

This program and library is free software; you can redistribute it and/or modify it under the terms of the GNU (Library) General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU (Library) General Public License for more details.

You should have received a copy of the GNU (Library) General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Last update 2001-07-06