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>
    </frameset>
    <noframes>
    Sorry, this browser does not support frames.
    No search capability provided.
    </noframes>

    
    				
  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.
    </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  
resultframe
String specifying the frame name for displaying the search result.
indexfile
URL specifying the index file to be loaded. The usual Java security rules apply.
helpfile
URL specifying the help file to be displayed when the Help button is pressed. That URL is displayed in the result frame.
kwlabel
String specifying the keyword entry label. If not specified the default is "Keywords:". If specified as empty string, no label is drawn.
searchbutton
String specifying the search button label. If not specified the default is "Search". If specified as empty string, no search button is drawn.
wordsbutton
String specifying the words button label. If not specified the default is "All Words". If specified as empty string, no words button is drawn.
clearbutton
String specifying the clear button label. If not specified the default is "Clear". If specified as empty string, no clear button is drawn.
helpbutton
String specifying the help button label. If not specified the default is "Help". If specified as empty string, no help button is drawn.
charmap
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="
      0000000100020003000400050006000700080009000A000B000C000D000E000F
      0010001100120013001400150016001700180019001A001B001C001D001E001F
      0020002100220023002400250026002700280029002A002B002C002D002E002F
      0030003100320033003400350036003700380039003A003B003C003D003E003F
      0040004100420043004400450046004700480049004A004B004C004D004E004F
      0050005100520053005400550056005700580059005A005B005C005D005E005F
      0060006100620063006400650066006700680069006A006B006C006D006E006F
      0070007100720073007400750076007700780079007A007B007C007D007E007F
      0080008100820083008400850086008700880089008A008B008C008D008E008F
      0090009100920093009400950096009700980099009A009B009C009D009E009F
      00A0010402D8014100A4013D015A00A700A80160015E0164017900AD017D017B
      00B0010502DB014200B4013E015B02C700B80161015F0165017A02DD017E017C
      015400C100C2010200C40139010600C7010C00C9011800CB011A00CD00CE010E
      01100143014700D300D4015000D600D70158016E00DA017000DC00DD016200DF
      015500E100E2010300E4013A010700E7010D00E9011900EB011B00ED00EE010F
      01110144014800F300F4015100F600F70159016F00FA017100FC00FD016302D9
      ">

 

Requirements  
  • 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).

 

Limitations  
  • 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.

 

Problems  
  • 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.

 





chw@ch-werner.de
Last update 2001-07-06