RuterSearch Documentation

RuterSearch Perl version 3.5
Programming Language: Perl, version 5; Also available in Php
Database support: MySQL and Text Delimited File

RuterSearch, RuterSoft, all code; copyright © 2001; Weston Ruter

RuterSearch homepage: http://www.ruter.net/soft/rutersearch/

Contents:

  1. History
  2. Features
  3. Installation
  4. Configuration and Customization
  5. Running RuterSearch
  6. Troubleshooting

Awhile ago, before I was a Perl programmer, I wanted to start a search engine. I searched and searched, but I couldn't find one that I could afford and one that I liked. So I settled for a lesser search engine (for $50) that I thought would serve my needs. Since I was not a programmer, I had no idea what features a search engine should have, and I paid the price for my naivety. That search engine was pathetic, a total disappointment, and a rip off. My mistake.

So when I became a Perl programmer, I started RuterSearch. I wanted it to be better than any other, and cheaper. So I incorporated everything that I would have wanted, and what I anticipate you need. I have spent more time on this project than any other, and I hope it shows!

History

v1.0 Perl
Winter '99
  • Simple search routine developed. Importance based on the matched word's location in the entry. (title, description, etc.)
  • Addition program for easy addition of new entries
  • Very easy customization of design in search and search result pages using substitutions
  • CSS used in layout of results
  • "Previous/Next page of results", "End of Results", and "No matches" messages scripted.
  • Helpful error messages
v2.0 Perl
Spring '00
  • Syntax for requiring words. (e.g.. +required)
  • Search History for keeping track of what the user has searched for.
v3.0 Perl
v1.0 Php
Summer '00
  • Radical redesign of search. Importance based on number of matches (including all sections) and locations in an entry.
  • Numerous new syntax features like quoted phrases ("a phrase"), required words (+required), required not words (-not), section restrictions (title, description, etc.) and wildcards searches (e.g. Ruter*, ?uter, *zilla, etc.).
  • Styling of matched words
  • Total customization with result template (resulttemplate.html)
  • Administration program for easy configuration of RuterSearch (no editing of code)
  • Very simple installation program.
v3.5 Perl
v1.5 Php
Winter '00
  • A couple of small bug fixes
  • MySQL database support added
  • Installation program integrated into administration
  • Administration completely re-done. Search history, entry management, documentation, and more can all be accessed through administration
  • Website Spider for the quick addition of many websites
  • Documentation greatly expanded
v4.0 Perl
v2.0 Php
(coming up)
  • Entry editing program
  • Done in 3.5: Website spider
  • Error help: online troubleshooting pages
  • Date restricted searches
  • New additions page

Features

  1. Installation program:  Sometimes large scripts are hard to install, especially for a novice. So I devised an installation program to automatically setup files for use on your server. All you have to do is upload all files and folders in the RuterSearch archive. Additionally, if you are using a UNIX type system you will need to edit the path to perl on the first lone of "admin.cgi" and chmod 755 admin.cgi. Detailed instructions on how to install RuterSearch can be found here.
  2. Administration: Many search engines require you to edit code in order for everything to be configured just how you want. Since most people are not programmers, this can be an unfriendly task. Therefore I created an Administration program to handle most of the configuration for you.
  3. Search syntax:  RuterSearch has more syntax features than even Yahoo! Here is the syntax for searching RuterSearch:

    Search results page searchresults.html: Where the results are displayed
    _totalentries_
    Total number of entries in your database.
    _totalresults_
    Total number of results from the search.
    _nextpageurl_
    Url of the next page of results. Javascript alert if at end
    _nextpage_
    Returns 'true' if there is another page of results, and 'false' if not.
    _previouspageurl_
    Url of the previous page of results. Javascript alert if at beginning
    _previouspage_
    Returns 'true' if there is a previous page of results, and 'false' if not.
    _stylewords_
    Returns 'true' if styling of words was used , and 'false' if not.
    _perpage_
    The number of results displayed per page
    _currentpage_
    The page of results that is being displayed
    _searchquerytext_
    Exactly what the user searched for in plain text. Not recommended for use in html tags.
    _searchqueryhtml_
    What the user searched for, but with some characters changed to html character entities. " to " etc... This should be used most often. Doesn't cause problems with html tags. 
    _searchqueryencoded_
    What the user searched for but url encoded. Example: %2BMozilla+does+%22X+M+L%22
    _searchtype_
    File type that was searched for. E.g. html
    _searchresults_
    Displays all the results. Either in a predefined format or the way you defined in "resulttemplate.html". See administration

    Result template resulttemplate.html: Template for displaying results. Must be turned on in administration
    _date_
    Date result was added/modified 
    _type_
    File type of result
    _title_
    Title of result
    _description_
    Description of result
    _url_
    Url of result
    _keywords_
    Keywords of result
    _author_
    Author of result

    Addition page: Where the user inputs the new entry
    _totalentries_
    Total number of entries in your database.

    Addition results page: Results of addition
    _totalentries_
    Total number of entries in your database.
    _date_
    Date entry was added/modified 
    _type_
    File type of entry
    _title_
    Title of entry
    _description_
    Description of entry
    _url_
    Url of entry
    _keywords_
    Keywords of entry
    _author_
    Author of entry

Installation

As of RuterSearch Perl version 3.5 and RuterSearch Php version 1.5, the installation program has been integrated into the administration program admin.cgi. Here are instructions for installing RuterSearch:

  1. Extract the files from the downloaded archive to a temporary folder.
  2. Upload all files and folders to the desired location on your server, most likely the CGI-BIN for Perl scripts. Usually this is done with an FTP client such as WS_FTP.
  3. For UNIX type systems, you will need to modify the first line of admin.cgi to reflect your path to perl. Most likely the first line will need to look like one of the following:
    #!/usr/bin/perl -w
      or
    #!/usr/local/bin/perl -w
    If these paths do not work, you can type in which perl into a Telnet prompt or just ask your system administrator.
  4. Additionally for UNIX type systems: set install.cgi's permissions to execute (Linux/Unix command CHMOD 755). Usually your FTP client will have CHMOD ability built in and you should be able to find it. You need to set admin.cgi's permissions to CHMOD 755 which means all execute, owner write, and read.
    If your FTP Client doesn't have CHMOD built in, you can simply type the command directly into a Telnet prompt. An example of this is:
    Login: johnsmith
    Password: (password hidden)

    [johnsmith@245.27.1.120 johnsmith]$ cd http-home/rutersearch
    [johnsmith@245.27.1.120 rutersearch]$ chmod 755 admin.cgi
  5. Now run admin.cgi from your browser and it will setup all files that will be used by RuterSearch.

Configuration and Customization

  1. After you install RuterSearch, you can configure it however how you like. And the best way to do this is through the RuterSearch administration program. Login to admin.cgi with your password (the default password is password).
  2. Basically everything that you might need to do to configure RuterSearch, you can do from within Administration. But customizing the page look is a bit different. Below I will explain:
  3. Customization

    The way RuterSearch displays pages is it that when it is run, it takes in specific HTML pages that you have created, and then it substitutes data onto specific locations on that page that you specify. This is done through the use of substitutions. By opening search.html (or any page listed below) in a text editor, you can design the search home page to look exactly how you want. Simply write HTML as you would normally for your website. When you want to display the total entries in the database, you would insert _totalentries_ into the HTML page where you want that text displayed. For more information about substitutions and a list of all substitutions for each HTML page, click here.

    Below is a list of each editable page with descriptions.

    To illustrate how to use substitutions, look at the following example which will display a message like "There are 125 entries in the database."

    <html>
        <head>
            <title>My Search Engine</title>
            <style type="text/css">
                body {
                    font-family: Arial, Helvetica;
                }
            </style>
        </head>
        <body>
            Welcome to my search engine. There are _totalentries_ entries in the database.
        </body>
    </html>

    The search results page is a bit more involved. In the <head> of searchresults.html, there is a <style> tag which contains information on how to display certain elements. The most important style is the .matchedWord class which tells the user's browser how to highlight a matched word (if that option is enabled). The following code in the <style> tag would highlight matched words in yellow.

    <style type="text/css">
        .matchedWord {
            background-color: yellow;
        }
    </style>

    The user needs to be able to navigate back and forth through the results that have been found. This navigation can be appended to the _searchresults_ substitution, or you can create your own navigation by using JavaScript and substitiutions together. The searchresults.html that comes with RuterSearch uses the JavaScript created navigation.

    Knowledge of HTML, preferably CSS, and possibly JavaScript, is required. But do not worry! These are very simple languages to learn. Pick up a book, or visit the W3C for official specifications.

Running RuterSearch

Troubleshooting

Error Code
  Description and Remedy
000
Unable to open configuration file. Either run administration (admin.cgi) or reinstall the program.
001
The database file cannot be found. Please verify that you have the correct filename entered in RuterSearch Administration
002
The database type is invalid. Please reset the the database type to "text" or "MySQL" in Administration.
003
The search page (search.html) cannot be found. Please make sure that there is a file names search.html in the "html" folder. If not you can extract a new one from your RuterSearch distribution archive.
004
The result template file 'html/resulttemplate.html' could not be found. Make sure that it is in the folder 'html', or you may need to reinstall.
005
Was not able to add to 'queryrecord.txt'. You may need to set the permissions to 'queryrecord.txt'. Make sure the permissions are for read and write (chmod 666).
006
Could not open search results file 'html/searchresults.html'. Make sure that the file is there, if it isn't, you should upload another.
007
Unable to open the file 'html/add.html'. Make sure that the file is there, if it isn't, you should upload another.
008
Unable to open the file 'html/additionresults.html'. Make sure that the file is there, if it isn't, you should upload another.

Validates as W3C XHTML 1.0