htsearch

ht://Dig Copyright © 1995-2002 The ht://Dig Group
Please see the file COPYING for license information.


HTML Form

The primary interface to htsearch is through an HTML form. When the form is submitted, the htsearch program will take values from the form and perform the actual search. The search can be modified in many ways with either hidden input fields or other HTML form tags. Study the examples to get a feel of what things are possible.

The HTML form is expected to contain at least an input text field named words. This is where the user will enter the search words. This may also include the wildcard '*' which matches all documents, potentially as restricted or modified by other search fields. Other values are also recognized but have appropriate defaults in case they are not used:

config
Specifies the name of the configuration file. The name here is the name without the path and without the .conf at the end. This file is assumed to be located in the CONFIG_DIR directory. Periods are not allowed in this field for security reasons (to prevent HTML authors from pointing all around at your files).
The default is htdig
exclude
This value is a pattern that specifies which URLs are to be excluded from the search results. If a URL matches one of these patterns it is discarded. Multiple patterns can be given, separated by a bar ("|"), or multiple definitions of the exclude input parameter can be given.
The default is specified by the exclude attribute in the configuration file.
format
This specifies the name of the template to display the search results in. There are two builtin templates named builtin-long and builtin-short which can be used, but any number of custom templates can also be defined. Find out more about the templates in the Output Templates section.
The format value can be specified as either a hidden input field or a drop down menu.
The default is specified by the template_name attribute in the configuration file.
keywords
Used to specify a list of required words that have to be in the documents. This list of words is added to the normal words value using logical "and"s.
An example use for this value is to make it a drop down menu with a limited set of predetermined categories or keywords to restrict the search. This can be very useful for very structured pages.
Note that the words may appear anywhere in the document. The scope of these required words is not limited to words in META tags with the "keywords" or "htdig-keywords" property, despite what the parameter name may suggest.
matchesperpage
Specifies how many matches will be displayed on each page of results.
The default is specified by the matches_per_page attribute in the configuration file. Since this value has to be a number, it either needs to be set using a hidden input field or a with a drop down menu.
method
This can be one of and, or, or boolean. It determines what type of search will be performed.
The default is specified by the match_method attribute in the configuration file. It is quite useful to make this item a drop down menu so the user can select the type of search at search time.
page
This should normally not be used. It is generated by the paged results display.
restrict
This value is a pattern that all URLs of the search results will have to match. This can be used to restrict the search to a particular subtree or subsection of a bigger database. Multiple patterns can be given, separated by a bar ("|"), or multiple definitions of the restrict input parameter can be given. Any URL in the search results will have to match at least one of these patterns.
Note that the restrict list does not take precedence over the exclude list - if a URL matches patterns in both lists it is still excluded from the search results.
The default is specified by the restrict attribute in the configuration file.
sort
This can be one of score, time, date, title, revscore, revtime, revdate, or revtitle. It determines what type of sort will be performed on the search results. The types time and date are synonymous, as are revtime and revdate, as all four sort on the time that the documents were last modified, if this information is given by the server. The sort methods that begin with rev simply reverse the order of the sort.
The default is specified by the sort attribute in the configuration file. It is quite useful to make this item a drop down menu so the user can select the type of sort at search time.
startyear, startmonth, startday, endyear, endmonth, endday
These values specify the allowed range of document modification dates allowed in the search results. They can be used to restrict the search to particular "ages" of documents, new or old.
The default is the full range of documents in the database. These values can also be specified by configuration attributes of the same names in the configuration file. If a negative number is given for any of these, it is taken as relative to the current year, month or day.

Last modified: $Date: 2002/01/27 05:33:20 $