Web Development Support
    General Info   Cool Tools
    Getting Started   Troubleshooting
    Design & Promotion   Feedback
 

Search this site:


view site map

LSearch

  1. Introduction
  2. Features and bugs
  3. Installing LSearch
  4. Build an index with the lsedit tool
  5. Create a form and put it on your Web site
  6. Using notfound.html
  7. Data security
  8. Installing LSearch in an alternate directory
  9. Installing LSearch in a departmental directory (without a public_html directory)
  10. Tips for using LSearch
  11. Description of files

Introduction

LSearch is an easy-to-use, robust search engine package that you may install on your Web site. It works best for small (under 200 pages) Web sites. The two main components of the LSearch package are:

lsedit.pl
A simple Web-based editor that you may use to record the pages in your site as well as accompanying keywords for each page. As the maintainer of your site, you will use lsedit.pl to record index entries.

lsearch.html
A sample search form, as well as a sample "results" template. People who visit your Web site will use the search form to enter keywords. The "results" template will display the pages which correspond to the keywords submitted. This file is also editable, so you may customize the appearance to suit the look and feel of your Web site.


Features and Bugs

Features of LSearch include:

  • Simple to install and use
  • Web-based editor to edit the index file
  • Editable results template
  • "Notfound" keywords are saved in a file that you may review periodically and update your index accordingly

Bugs of LSearch include:

  • No support for boolean operations, such as
    + - and or not
  • Problems with upper and lower case
  • Only searches for letters and numbers (no special characters)
  • Index entries may be deleted only by editing the data file

Installing LSearch

Before installing LSearch, you will need to have a Web site at U.Va. Click here for more information about setting up Web sites at U.Va.

In order to install LSearch, you will need to perform two basic steps:

  1. Log in to your UNIX account

    If you have UMenu, choose the option "Go to UNIX". You will see prompt similar to the following:

    node4: /home/mst3k $

  2. Install LSearch

    Enter the following command:

    /contrib/bin/lssetup -p <password>

    where <password> is some word (do not use your e-mail or UNIX account password). If you do not supply a password, the installation process will fail.

    Here is an explicit example:

    /contrib/bin/lssetup -p skyblue

    You should then see output similar to the following:

    Installing /home/mst3k/public_html/lspages.dat
    Installing /home/mst3k/public_html/lsearch.pl
    Installing /home/mst3k/public_html/lsedit.pl
    Installing /home/mst3k/public_html/lsearch.html
    Installing /home/mst3k/public_html/Readme.lsearch file.

    All done.
    To edit your search data file, use the URL:
    http://www.people.virginia.edu/~mst3k/lsedit.pl
    and the password
    skyblue
    Documentation is at:
    http://www.itc.virginia.edu/desktop/web/lsdoc.html

    You need to edit your HTML form. Change the action
    attribute of the <form action= ... > tag to use the
    appropriate one of the following URL's.
    Write down the following lines for later reference:
    http://www.people.virginia.edu/~mst3k/lsearch.pl
    http://www.people.virginia.edu/cgi-uva/cgiwrap/mst3k/lsearch.pl

    Before logging out of your UNIX account, write down the last two lines that appear on your screen for later reference.

    You may now log out of your UNIX account.


Build an index with the lsedit tool

Open your Web browser (such as Netscape or Internet Explorer) and go to your lsedit.pl file. For example, if your user id is mst3k, your lsedit.pl file is located at:

http://www.people.virginia.edu/~mst3k/lsedit.pl

Log in to the editor with the password you supplied when you installed LSearch in Step 2 above. You will then see a small example data file with one record and three keywords, similar to the following:

Insert new record before number

Click on a number to edit that record. Fields are:URL, Description, keywords. Fields are separated by *

#0 home.html * Your home page description * home page keywords here help info


Keywords are separated by a red asterisk ( * ). For this reason, you may not use an asterisk in any of your index records.

Editing existing records

If you would like to edit the keywords for your home.html file, click on the #0 link. This will take you to a screen where you may edit individual records.

Enter whatever Description and Keyword values you like, and then click "Modify Record".

Modify record: 0

File or URL:
Description:
Values:      


Adding new records

New records are always inserted before an existing record. To add a new record, enter a 0 in the "Insert new record before number" field, as below, and then click the "Insert new" button.

Insert new record before number

Click on a number to edit that record. Fields are:URL, Description, keywords. Fields are separated by *

#0 home.html * Your home page description * home page keywords here help info


You will then get a new record, to which you should add the name of another file in your Web site, a description, and keyword values. Keyword values should be all lowercase, and they should be separated by spaces. An example is as follows:

Modify record: 0

File or URL:
Description:
Values:      


When you have finished entering the new information, click on the "Modify record" button.

Note

When search results are returned, they are returned in the order in which they occur in the data file. For this reason, you should put the more important records towards the beginning of the file. There is no way to reorder the records without using a UNIX text editor, which is a complex operation that is not covered in this document.


Create a form and put it on your Web site

A file called lsearch.html has already been installed in your Web site, and you may use this both as a search form and as a results template.

If you would like to edit the lsearch.html file to reflect the style of your Web site, you may do so, but be careful not to remove the following string:

{search}

or your template will no longer work. {search} is the placeholder for pages that match the keywords that have been entered.

Note

If you would like to incorporate the search form on a different page in your Web site (for example, if you want a search form to appear at the bottom of a page in your Web site or as part of a navigation banner), you should copy the html source of the form, which will look similar to the following:

<P><FORM ACTION="http://www.people.virginia.edu/~mst3k/lsearch.pl" METHOD=POST>
<P><INPUT TYPE=text NAME=findme VALUE="" SIZE=50><INPUT TYPE=submit NAME=Submit VALUE="Submit">
</FORM>

and paste it in your document.


Using notfound.html

Whenever a visitor at your site enters keywords that return no search results, those keywords are added to a file called "notfound.html". You should check this file periodically. This will help you determine if there are additional keywords you should consider adding to your index file. If you performed the default installation of LSearch, and if your user id is mst3k, you may view your notfound.html file at:

http://www.people.virginia.edu/~mst3k/notfound.html


Data security

When you install LSearch, you supply a password to use in order to access your index files. As LSearch is installed, that password is embedded in the lsedit.pl script. Anyone who reads that script will see this password. This is a very modest level of security. It will prevent most people from editing your index data file, but a determined hacker may find a way to break into your index data file. You should keep a backup of your index data file (the file is called "lspages.dat") in some location outside of your Web site.

If you are using lsedit.pl from a public lab, make sure no one is watching when you enter your password, and always follow the instructions about restarting or refreshing the computer when you leave the lab.

Since this password is in clear text in the lsedit.pl script, if your Web site security is compromised, this password will also be compromised. For this reason DO NOT use your UNIX or e-mail password as your LSearch password. If you have further questions about security, please write to web-consult@virginia.edu.


Installing in an alternate directory

If you use the default installation of LSearch, as outlined earlier in this document, LSearch will be installed in your public_html directory. Technically speaking, LSearch can be installed in any directory, although in general you must install it in your public_html directory, or a subdirectory of your public_html directory. Contact your system administrator (or write to web-consult@virginia.edu) for detailed information. To install LSearch in an alternate directory, use the following command at the UNIX prompt:

/contrib/bin/lssetup -p <password> -d <directory-name>

where <password> is some word (do not use your e-mail or UNIX account password) and <directory-name> is the full path to the directory in which you would like to install LSearch.

Here is an explicit example:

/contrib/bin/lssetup -p skyblue -d /home/mst3k/public_html/survey/

If you do not use the complete file path, the installation will not work correctly.


Installing LSearch in a departmental directory (without a public_html directory)

Many departmental Web sites do not have a public_html directory. If this is your situation, you will need to type the following command at the UNIX prompt:

/contrib/bin/lssetup -p <password> -d <directory-name> -s

where <password> is some word (do not use your e-mail or UNIX account password), and <directory-name> is the full path to the directory in which you would like to install LSearch. Do not forget the -s at the end!

Here is an explicit example:

/contrib/bin/lssetup -p skyblue -d /www/doc/desktop/ -s

If you are a programmer, you may find the following details interesting, but you don't need to understand them to use LSearch. The addition of the "-s" changes the configuration of the Perl CGI scripts and installs the program lswriter, which is suid. The suid feature is necessary for a program to write to a file in a Web directory which is not a particular user's public_html directory. The suid feature cannot be added to Perl scripts, and therefore the lswriter program is necessary.

If you try to edit your index of pages using lsedit.pl, and no update occurs, check the permissions on the lswriter program. To work properly, it must have the "sticky bit" (s instead of x) set for the file's owner. If you look at a long listing (Unix command:  ls -l  ) of the files, you should see something similar to the following (for owner "mst3k" and group "mygroup"):

-rwsrwxr-x  1  mst3k  mygroup  7405  May 25 15:20  lswriter*

If it does not, use the following command to make the change:

chmod u+s lswriter


Tips for using LSearch

  • Add the keyword "all" to each index entry. That way, you can type "all" into the search form and see all of the records in LSearch. You could also create subcategories for your pages and use a keyword to group those pages.
  • Check your "notfound.html" file regularly. It may contain keywords you might consider adding to some of your index entries.
  • If you use the webstats package (for more info see http://www.itc.virginia.edu/desktop/web/webstats.html), LSearch shows up in the Referrer Request reports. You will be able to tell if people are using your search engine!
  • You can use LSearch to index pages that aren't in your personal site -- in other words, you can use it as a portable "bookmark" index.

Description of files

The following files are created when you install LSearch:

  • lsearch.pl
    A perl script to take HTML form data and put it in a file
  • lsedit.pl
    A perl script to edit the data index file "lspages.dat"
  • lspages.dat
    A text data file. You edit this file from via the Web with the lsedit.pl script.
  • lsearch.html
    An example search form and results template. You may customize this file, but you must maintain the {search} string, or search results will not display correctly
  • lswriter
    A C program used to write to lspages.dat and notfound.html for Web sites which are not stored in a public_html directory. This file is only installed when you use the -s option when installing LSearch. See above for checking and changing, if necessary, permissions on this file.
  • Readme.lsearch
    A text file that contains most of the documentation in this Web site.

Web Development Support | General Info | Getting Started | Design & Promotion
Cool Tools | Troubleshooting | Feedback

If you need further assistance with Web applications or questions, send e-mail to web-consult@virginia.edu or call the ITC Help Desk at 924-3731.

© 2008 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.