SFE Search

This script is freeware. You may modify it to suit your needs, and you may distribute it, but you may NOT do both. You can only distribute this script in it's origional form, and if you modify it, you may only do so to suit your own needs and may NOT charge someone to install or modify this script.

**********************
Now you will need to index your site. To do this, point your browser to your index.cgi file and the indexing should begin. For example, if you put it in your cgi-bin, go to index.cgi.

It should print a list of all of the files it has indexed. On a larger site it is possible that the script could time out before being able to index the whole site - this script is primarily intended for small to medium sized sites. If it does time out, you should still be able to search what has been indexed.

Now you should call search.html from your web browser and try a search. Note that this script will not index words contained in the words.txt file - you can add or remove from this file, depending on your needs. It contai ns common words that shouldn't be indexed for searching. The format is one word per line.

* * * * * *
Now that the script is working properly, it is time for some customization :) You should open up results.html in any text editor or HTML editor. Just note that the comments within this file are replaced by the script at run time by the output of the script.

<!-- KEYWORDS -->
This is replaced with the words the user searched for.

<!-- RESULTS -->
This is replaced with the actual search results, 10 results per page.

<!-- LINK -->
This is replaced with the "<< Prev | Next >>" links, if applicable.

Note that the order does not matter - you can place the link above or below the search results, etc. You may also wish to include a search box on the results page (see the example page) to allow the user to search again. Also note that they are CASE SENSITIVE.

The format of the search form is simple. There are 3 fields:

  • Q - The search words
  • X - Set to any non-zero value to find exact match only, otherwise it will match any keywords
  • E - Set to any non-zero value to search the entire document, otherwise it will only search the title.

    You can use GET or POST method - both will work exactly the same. If you are familiar with HTML forms, you should have no problems adding a search box to any page you like within your site.

    *********************************************************
    Always visit http://www.hostfacts.com/scripts/ for the latest Perl or PHP scripts by SFE Software.
    (c) 1999 Justin Nelson, SFE Software
    All Rights Reserved.