Create a Search Index for Your Web Site |
![]() | |
| · Introduction | ||
| · Create a Search Database | ||
| · Create a Search Template | ||
| · Create an HTML Form for Searching |
This section provides an introduction to creating a search-page for your LiveZone-hosted Web site.
Adding search capability to your Web site involves three parts:
Search databases are created and updated using the LiveZone self-administration control panel http://www.livezone.com/admin/ . When you update your Web sitecontent, you must tell our server to update your databases to reflect your latest changes.
Create a text-file with the format of the example below. We recommend that you place the template file in the /admin/search directory of your Web site's FTP tree. This at the level above the /htdocs directory, so Web browsers can not directory access this file. You may place these template files anywhere else you choose, but we've found it convenient to keep them in a central location for ease of maintenance. Similarly, while we recommend that you name your search template files with extension .wais, this is not necessary as long as you're consistent, and remember to match the filenames in the HTML search form's ACTION.
This example assumes that the search databases being searched have been named "database_sales", "database_support", and "database_pr". You may choose different names, and may reference any number of search databases you've created, from one to as many as ten different databases.
# example search template configuration file
PageTitle "This is The Title For Our Example Search"
# This defines the title of the search-results page that is returned
# following every search request.
# If this is a string, it will be a title only.
# If it specifies an HTML file, this file will be prepended to wwwwais results.
SwishSource /admin/search/database_sales.swish
SwishSource /admin/search/database_support.swish
SwishSource /admin/search/database_pr.swish
# The pathes to the search database file(s). You must include the .swish
# filename extension even though you do not specify that extension when
# creating the search database. You must specify the /admin/search path
# for the search database because that is where the self-administration
# utilities place them.
SelfURL "/cgi-bin/mycgi/search"
# The self-referencing URL for the search program.
MaxHits 15
# The maximum number of search results to return.
SortType score
# How results are sorted. This can be "score", "lines", "bytes",
# "title", or "type".
AddrMask all
# Only addresses specified here will be allowed to use the gateway.
# For the above mask option, these rules apply:
# 1) You can use asterisks in specifying the string, at either
# ends of the string:
# "192.100.*", "*100*", "*2.100.2"
# 2) You can make lists of masks:
# "*192.58.2,*.2", "*.100,*171.128*", ".58.2,*100"
# 3) A mask without asterisks will match EXACTLY:
# "192.100.58.2"
# 4) Define as "all" to allow all sites.
SwishBin /usr/bin/swish
# The full path to your search program. Do not change this unless you know
# what you are doing.
UseIcons yes
# Define as "yes" or "no" if you do or don't want to use icons.
# Determines whether icons are displayed beside each file returned
# on a search result page.
IconUrl /icons
# Where all your icons are kept.
# The example '/icons' is the global icon directory that LiveZone servers
# map to http://www.yourDomain.com/icons/ . You may use other URL prefixes instead.
TypeDef .html "HTML file" $ICONURL/layout.gif text/html
TypeDef .htm "HTML file" $ICONURL/layout.gif text/html
TypeDef .txt "text file" $ICONURL/text.gif text/plain
TypeDef .ps "PostScript file" $ICONURL/a.gif application/postscript
TypeDef .eps "PostScript file" $ICONURL/a.gif application/postscript
TypeDef .man "man page" $ICONURL/text.gif application/x-troff-man
TypeDef .gif "GIF image" $ICONURL/image2.gif image/gif
TypeDef .jpg "JPEG image" $ICONURL/image2.gif image/jpeg
TypeDef .pict "PICT image" $ICONURL/image2.gif image/x-pict
TypeDef .xbm "X bitmap image" $ICONURL/image2.gif image/x-xbitmap
TypeDef .au "Sun audio file" $ICONURL/sound2.gif audio/basic
TypeDef .snd "Mac audio file" $ICONURL/sound2.gif audio/basic
TypeDef .mpg "MPEG movie" $ICONURL/movie.gif video/mpeg
TypeDef .mov "QuickTime movie" $ICONURL/movie.gif video/quicktime
TypeDef .Z "compressed file" $ICONURL/compressed.gif application/compress
TypeDef .gz "compressed file" $ICONURL/compressed.gif application/gnuzip
TypeDef .zip "zipped file" $ICONURL/compressed.gif application/zip
TypeDef .uu "uuencoded file" $ICONURL/uuencoded.gif application/uudecode
TypeDef .hqx "Binhex file" $ICONURL/binhex.gif application/mac-binhex40
TypeDef .tar "tar'red file" $ICONURL/tar.gif application/x-tar
TypeDef .c "C source" $ICONURL/c.gif text/plain
TypeDef .pl "Perl source" $ICONURL/p.gif text/plain
TypeDef .py "Python source" $ICONURL/p.gif text/plain
TypeDef .tcl "TCL source" $ICONURL/script.gif text/plain
TypeDef .src "WAIS index" $ICONURL/index.gif text/plain
TypeDef .?? "unknown" $ICONURL/unknown.gif text/plain# information for figuring-out file types based on suffix can be found in
# the LiveZone support pages at: http://www.livezone.com/supportzone/mimetypes.shtml# Suffix matching is case insensitive.
# TypeDef .suffix "description" file://url.to.icon.for.this.type/ MIME-type
# You can use $ICONURL in the icon URL to substitute the root icon directory.
Here's an example form used to operate a search using the template above. This assumes that the text-file above was saved as /admin/search/global_search.wais'. Note where the template filename is referrenced below in the HTML ACTION phrase; you must change this to your own template's filename.
<FORM Method=POST Action="/cgi-bin/mycgi/search?waisconf=/admin/search/global_search.wais">
<P><CENTER><FONT SIZE=+1><B>Ex</B></FONT></CENTER></P>
<P> </P>
<P>Search this site for keywords related to the article you might be interested in.</P>
<P>Use words AND OR NOT to limit your search. For example:
spine and doctor<BR>
spine or ankle<BR>
spine and doctor not bone
</P>
<P><INPUT NAME="keywords" TYPE="text" SIZE="30"> <INPUT NAME="name" TYPE="submit" VALUE="Search"></FORM>
![]() www.livezone.com |
Last Updated January 2007 |