Home arrow Site Administration arrow Page 8 - Site Search with HTDIG

Custom Job - Administration

Want to add a search engine to your Web site but don't know how? Well, today's your lucky day! In this tutorial, find out how to obtain, install and use the popular ht://Dig indexing engine to add powerful, effective search capabilities to your site with minimal time and fuss.

TABLE OF CONTENTS:
  1. Site Search with HTDIG
  2. Digging Deep
  3. Source Control
  4. Script Barf
  5. Variable Control
  6. A Well-Formed Plan
  7. What You See
  8. Custom Job
  9. Out With The Old
  10. Caveat Emptor
  11. Ending The Dig
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 21
April 12, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

ht://Dig allows you to customize both the search form, and the result page generated from a query. In order to demonstrate, I'll create a plain-vanilla search form, called "search.html", which looks like this:

 
<form method="post" action="/cgi-bin/htsearch">
<
input type="text" name="words" size="15">
<
input type="submit" value="Begin Search">
</
form

There are a couple of important things to note here. The first is the
ACTION attribute of the <FORM> element, which must point to the "htsearch" utility located in the Web server's CGI directory - you'll remember that this location was specified when configuring the software.

 
<form method="post" action="/cgi-bin/htsearch"
... 
</form

The second is the search box itself - note that this element must be named "words", so that the "htsearch" utility knows to use the data within it as the search string.

 
<input type="text" name="words" size="15"

A number of other variables may also be set in this form to control the
behavior of "htsearch" - here's a brief list:

VARIABLE

WHAT IT MEANS

config

sets the name of the configuration file to use

matchesperpage

sets number of records per result page

method

sets type of search (any word, all words, Boolean)

exclude

if set, excludes URLs matching this pattern from the result
set

restrict

if set, includes only those URLs matching this pattern in
the result set

sort

sorting method for result set

Controlled Behavior

Here's an example:

 
<form method="post" action="/cgi-bin/htsearch">
<
input type="text" name="words" size="15">
<
input type="hidden" name="format" value="builtin-long">
<
input type="hidden" name="matchesperpage" value="25">
<
input type="hidden" name="method" value="and">
<
input type="hidden" name="sort" value="score">
<
input type="submit" value="Begin Search">
</
form

More information on what these variables mean can be found in the ht://Dig documentation, at http://www.htdig.org/. For a working example, refer to the sample form installed by the software (as discussed on the previous page).



 
 
>>> More Site Administration Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: