Site Search Applet version 1.2.4
Author: Patrik Lundin , patriklundin.info, http://www.lundin.info

Download applet here

Description
The Applet
Usage
Parameters
Important Notes
Questions and Answers

Description :
This applet searches a website for keywords by parsing and following links on the site.
The applet is mostly suitable for small and medium sized web sites since it searches by
following links.

After it has been configured and placed on the webpage just write search words in the
search field, separate several search words with a colon or space and press search.
When the applet indicates it is finished ( look at the top of the applet )
double click on any of the links to go to that page.

The applet is extremely configurable, you can change all the colors and the texts displayed.
You can also specify the target for where the links should load when double clicked on
and various other features, look at the list of parameters.

The Applet

Words you can testsearch for on this site: java, patrik, search


Usage :

Copy the class file Search.class into your webdirectory and then
put an applet tag like this one on your page :

<APPLET CODE="Search.class" WIDTH=325 HEIGHT=171>
<param name=firstpage value=index.html>
<param name=targetname value="_top">
<param name=maxhits value=30>
</APPLET>

Make sure the "firstpage" parameter points to the file where the applet
should start to search from, this file should contain links to all other pages.

Important Notes :
  • For security reasons a Java Applet can only make connections back to it's own origin
    therefore links outside the domain the applet resides on will not be searched.
  • The applet only works with the ISO8859-1 encoding ( Western Latin ).
  • Although the applet will work in old web browsers like IE 3.0 or Netscape 2.0x
    poor Java support may lead to unexpected results when using the applet in these browsers,
    including the look of the applet.
Questions And Answers :

The browser gives a "Class not found error"
Make sure the class is in the right directory, should be the
same directory as the page containing the applet tag.
Also make sure the class name is correct,
it should be exactly Search.class ( note the capital 'S' ).

The browser says something like "Class Format Error: bad magic number"
or it says something about a pool

The class file is corrupted, probably because it was uploaded through ftp
as an ascii file. Make sure you upload the class file as a binary file.

The applet doesn't seem to follow links
Make sure the "firstpage" parameter points to a file containing the
links you want the applet to follow. Note that the applet doesn't follow
external links ( links outside the domain where the applet resides )

The applet doesn't seem to follow links when it is run
locally on my harddrive or cd-rom

Make sure the applet ( the class file and the page that uses it ) is in the root
of the files it should search also make sure the "firstpage" parameter points to a
file with links in it, this file should also be in the root of the files it links to.

When I change a parameter the applet doesn't seem to care
Not all browsers let you change the parameters when the applet already is started,
restart your browser to make it reflect the changes.
Also read the note about Internet Explorer in the "important notes" section.

The links don't load in the right frame despite setting the "targetname" parameter
IE 4.x seem to have a problem with the use of "_" ( underscore ) in frame/target names when targeting
a url from a java applet, if your frame names have "_" in them then consider renaming them.
Remember to change the "targetname" parameter if you rename your frames.

The search results get "viped out" when returning to the search page
This is completely normal and due to the way a java applet is treated in the browser,
IE 4.x will kill the applet as soon as you leave the page, all resources is released so the
applet cannot retain any information about the search results.
Netscape will time out the applet when you leave the page containing it, thus the vipe out phenomena
will seem less apparent in Netscape but it will occur if you leave the search page for several minutes.
There are a couple of ways you can avoid this phenomena:
o Put the applet in a frame and target the search results to another frame, the applet will still be alive
and well as long as the frame containing it is loaded in the browser.
o Set the "targetname" parameter to "_blank", this will open up the search result in a new window when
double clicked on, the original window with the search applet will still be available behind the new window.

I changed a page but I can't seem to search for the changes
The browser has probably cached your page, restart the browser or
clear the cache if possible in your browser. You might also want to check
the cache settings in your browser.

How can I make the applet faster ?
You can have several search pages for different categories or areas of your site,
there are two ways to accomplish this:
o Divide your site into several directorys, have one applet for each directory
and set the "forwardonly" parameter so the applet only searches that directory
and any subdirectories.
o Make several start pages with links to different areas of your site, then have one
search applet per link page and set the "firstpage" to that page and then set the "nofollow"
parameter to true. This will make the applets only search the links specified on the
link pages and not follow any other links.
o Set the parameters "parsehtml" and "translateentitys" to false, this will make
the applet faster but the quality of the search might be less since the html code
will be searched and any entitys ( for example &Auml; ) will not be translated.



.