Configuration

hl://Dig requires a configuration file and several HTML files to operate correctly. Fortunately, when hl://Dig is installed, a very reasonable configuration is created and in most cases only minor modifications to the files are necessary.

Below, we will use the variables that were set in CONFIG to designate specific paths.

Standard files:


${CONFIG_DIR}/hldig.conf

This is the main runtime configuration file for all programs that make up hl://Dig. The file is fully described in the Configuration file manual.

When hl://Dig is installed, several attributes will be customized to your particular environment, but for reference, here is a sample copy of what it can look like:


#
# Example config file for hl://Dig.
#
# This configuration file is used by all the programs that make up hl://Dig.
# Please refer to the attribute reference manual for more details on what
# can be put into this file.  (https://solbu.github.io/hldig/confindex.html)
# Note that most attributes have very reasonable default values so you
# really only have to add attributes here if you want to change the defaults.
#
# What follows are some of the common attributes you might want to change.
#

#
# Specify where the database files need to go.  Make sure that there is
# plenty of free disk space available for the databases.  They can get
# pretty big.
#
database_dir:           /opt/www/var/hldig/db

#
# This specifies the URL where the robot (hldig) will start.  You can specify
# multiple URLs here.  Just separate them by some whitespace.
# The example here will cause the hl://Dig homepage and related pages to be
# indexed.
# You could also index all the URLs in a file like so:
# start_url:           `${common_dir}/start.url`
#
start_url:              https://solbu.github.io/hldig/

#
# This attribute limits the scope of the indexing process.  The default is to
# set it to the same as the start_url above.  This way only pages that are on
# the sites specified in the start_url attribute will be indexed and it will
# reject any URLs that go outside of those sites.
#
# Keep in mind that the value for this attribute is just a list of string
# patterns. As long as URLs contain at least one of the patterns it will be
# seen as part of the scope of the index.
#
limit_urls_to:          ${start_url}

#
# If there are particular pages that you definitely do NOT want to index, you
# can use the exclude_urls attribute.  The value is a list of string patterns.
# If a URL matches any of the patterns, it will NOT be indexed.  This is
# useful to exclude things like virtual web trees or database accesses.  By
# default, all CGI URLs will be excluded.  (Note that the /cgi-bin/ convention
# may not work on your web server.  Check the  path prefix used on your web
# server.)
#
exclude_urls:           /cgi-bin/ .cgi

#
# Since hl://Dig does not (and cannot) parse every document type, this
# attribute is a list of strings (extensions) that will be ignored during
# indexing. These are *only* checked at the end of a URL, whereas
# exclude_url patterns are matched anywhere.
#
# Also keep in mind that while other attributes allow regex, these must be
# actual strings.
#
bad_extensions:         .wav .gz .z .sit .au .zip .tar .hqx .exe .com .gif \
        .jpg .jpeg .aiff .class .map .ram .tgz .bin .rpm .mpg .mov .avi .css

#
# The string hldig will send in every request to identify the robot.  Change
# this to your email address.
#
maintainer:             unconfigured@hldig.searchengine.maintainer

#
# The excerpts that are displayed in long results rely on stored information
# in the index databases.  The compiled default only stores 512 characters of
# text from each document (this excludes any HTML markup...)  If you plan on
# using the excerpts you probably want to make this larger.  The only concern
# here is that more disk space is going to be needed to store the additional
# information.  Since disk space is cheap (! :-)) you might want to set this
# to a value so that a large percentage of the documents that you are going
# to be indexing are stored completely in the database.  At SDSU we found
# that by setting this value to about 50k the index would get 97% of all
# documents completely and only 3% was cut off at 50k.  You probably want to
# experiment with this value.
# Note that if you want to set this value low, you probably want to set the
# excerpt_show_top attribute to false so that the top excerpt_length characters
# of the document are always shown.
#
max_head_length:        10000

#
# To limit network connections, hl://Dig will only pull up to a certain limit
# of bytes. This prevents the indexing from dying because the server keeps
# sending information. However, several FAQs happen because people have files
# bigger than the default limit of 100KB. This sets the default a bit higher.
# (see <https://solbu.github.io/hldig/FAQ.html> for more)
#
max_doc_size:           200000

#
# Most people expect some sort of excerpt in results. By default, if the
# search words aren't found in context in the stored excerpt, hlsearch shows
# the text defined in the no_excerpt_text attribute:
# (None of the search words were found in the top of this document.)
# This attribute instead will show the top of the excerpt.
#
no_excerpt_show_top:    true

#
# Depending on your needs, you might want to enable some of the fuzzy search
# algorithms.  There are several to choose from and you can use them in any
# combination you feel comfortable with.  Each algorithm will get a weight
# assigned to it so that in combinations of algorithms, certain algorithms get
# preference over others.  Note that the weights only affect the ranking of
# the results, not the actual searching.
# The available algorithms are:
#       accents
#       exact
#       endings
#       metaphone
#       prefix
#       regex
#       soundex
#       speling [sic]
#       substring
#       synonyms
# By default only the "exact" algorithm is used with weight 1.
# Note that if you are going to use the endings, metaphone, soundex, accents,
# or synonyms algorithms, you will need to run hlfuzzy to generate
# the databases they use.
#
search_algorithm:       exact:1 synonyms:0.5 endings:0.1

#
# The following are the templates used in the builtin search results
# The default is to use compiled versions of these files, which produces
# slightly faster results. However, uncommenting these lines makes it
# very easy to change the format of search results.
# See <https://solbu.github.io/hldig/hts_templates.html> for more details.
#
# template_map: Long long ${common_dir}/long.html \
#               Short short ${common_dir}/short.html
# template_name: long

#
# The following are used to change the text for the page index.
# The defaults are just boring text numbers.  These images spice
# up the result pages quite a bit.  (Feel free to do whatever, though)
#
next_page_text:         <img src="/hldig/buttonr.gif" border="0" align="middle" width="30" height="30" alt="next">
no_next_page_text:
prev_page_text:         <img src="/hldig/buttonl.gif" border="0" align="middle" width="30" height="30" alt="prev">
no_prev_page_text:
page_number_text:       '<img src="/hldig/button1.gif" border="0" align="middle" width="30" height="30" alt="1">' \
                        '<img src="/hldig/button2.gif" border="0" align="middle" width="30" height="30" alt="2">' \
                        '<img src="/hldig/button3.gif" border="0" align="middle" width="30" height="30" alt="3">' \
                        '<img src="/hldig/button4.gif" border="0" align="middle" width="30" height="30" alt="4">' \
                        '<img src="/hldig/button5.gif" border="0" align="middle" width="30" height="30" alt="5">' \
                        '<img src="/hldig/button6.gif" border="0" align="middle" width="30" height="30" alt="6">' \
                        '<img src="/hldig/button7.gif" border="0" align="middle" width="30" height="30" alt="7">' \
                        '<img src="/hldig/button8.gif" border="0" align="middle" width="30" height="30" alt="8">' \
                        '<img src="/hldig/button9.gif" border="0" align="middle" width="30" height="30" alt="9">' \
                        '<img src="/hldig/button10.gif" border="0" align="middle" width="30" height="30" alt="10">'
#
# To make the current page stand out, we will put a border around the
# image for that page.
#
no_page_number_text:    '<img src="/hldig/button1.gif" border="2" align="middle" width="30" height="30" alt="1">' \
                        '<img src="/hldig/button2.gif" border="2" align="middle" width="30" height="30" alt="2">' \
                        '<img src="/hldig/button3.gif" border="2" align="middle" width="30" height="30" alt="3">' \
                        '<img src="/hldig/button4.gif" border="2" align="middle" width="30" height="30" alt="4">' \
                        '<img src="/hldig/button5.gif" border="2" align="middle" width="30" height="30" alt="5">' \
                        '<img src="/hldig/button6.gif" border="2" align="middle" width="30" height="30" alt="6">' \
                        '<img src="/hldig/button7.gif" border="2" align="middle" width="30" height="30" alt="7">' \
                        '<img src="/hldig/button8.gif" border="2" align="middle" width="30" height="30" alt="8">' \
                        '<img src="/hldig/button9.gif" border="2" align="middle" width="30" height="30" alt="9">' \
                        '<img src="/hldig/button10.gif" border="2" align="middle" width="30" height="30" alt="10">'


${SEARCH_DIR}/search.html

This is the default search form. It is an example interface to the search engine, hlsearch. The file contains a form with as its action a call to hlsearch. There are several form variables which hlsearch will use. More about those can be found in the hlsearch documentation.

An example file can be as follows:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>hl://Dig WWW Search</title>
</head>
<body bgcolor="#eef7ff">
<h1>
<a href="https://solbu.github.io/hldig"><IMG SRC="/hldig/logo.jpg" align="bottom" alt="hl://Dig" border="0"></a>
WWW Site Search</h1>
<hr noshade size="4">
This search will allow you to search the contents of
all the publicly available WWW documents at this site.
<br>
<p>
<form method="post" action="/cgi-bin/hlsearch">
<font size="-1">
Match: <select name="method">
<option value="and">All
<option value="or">Any
<option value="boolean">Boolean
</select>
Format: <select name="format">
<option value="builtin-long">Long
<option value="builtin-short">Short
</select>
Sort by: <select name="sort">
<option value="score">Score
<option value="time">Time
<option value="title">Title
<option value="revscore">Reverse Score
<option value="revtime">Reverse Time
<option value="revtitle">Reverse Title
</select>
</font>
<input type="hidden" name="config" value="hldig">
<input type="hidden" name="restrict" value="">
<input type="hidden" name="exclude" value="">
<br>
Search:
<input type="text" size="30" name="words" value="">
<input type="submit" value="Search">
</form>
<hr noshade size="4">
</body>
</html>



${COMMON_DIR}/header.html

This file is the file that is output before any of the search results are produced in a search. This file can be customized to reflect your particular web look-and-feel, for example. Take note that this file is only the top part of the full HTML document that is produced when search results are displayed. This means that it should start with the proper HTML introductory tags and title.

This file will not just simply be copied. Instead, the search engine will look for special variables inside the file. These variables will be replaced with the appropriate values for the particular search it is used for. For more details of the use of these variables, consult the hlsearch templates documentation.

Below is the default header.html file that gets installed. Note that it contains a form to allow the user to refine the search.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Search results for '$&(WORDS)'</title></head>
<body bgcolor="#eef7ff">
<h2><img src="/hldig/logo.jpg" alt="hl://Dig">
Search results for '$&(LOGICAL_WORDS)'</h2>
<hr noshade size="4">
<form method="get" action="$(CGI)">
<font size="-1">
<input type="hidden" name="config" value="$&(CONFIG)">
<input type="hidden" name="restrict" value="$&(RESTRICT)">
<input type="hidden" name="exclude" value="$&(EXCLUDE)">
Match: $(METHOD)
Format: $(FORMAT)
Sort by: $(SORT)
<br>
Refine search:
<input type="text" size="30" name="words" value="$&(WORDS)">
<input type="submit" value="Search">
</font>
</form>
<hr noshade size="1">
<strong>Documents $(FIRSTDISPLAYED) - $(LASTDISPLAYED) of $(MATCHES) matches.
More <img src="/hldig/star.gif" alt="*">'s indicate a better match.
</strong>
<hr noshade size="1">


${COMMON_DIR}/footer.html

This file is output after all the search results have been displayed. All the same header.html rules apply to this file, except that it is supposed to contain all the ending HTML tags.

Below is the default footer.html file that gets installed. Note that it contains the page navigation stuff.


$(PAGEHEADER)
$(PREVPAGE) $(PAGELIST) $(NEXTPAGE)
<hr noshade size="4">
<a href="https://solbu.github.io/hldig/">
<img src="/hldig/logo.jpg" border="0" alt="hl://Dig">hl://Dig $(VERSION)</a>
</body></html>


${COMMON_DIR}/wrapper.html

This file may be used in place of the header.html and footer.html files above. It is simply the concatenation of these two files, with the pseudo-variable $(HTSEARCH_RESULTS) as a separator for the header and footer sections. All the same header.html and footer.html rules apply to this file. To make this file override the header and footer files above, you must define the search_results_wrapper attribute.


${COMMON_DIR}/nomatch.html

If a search produces no matches, this file is displayed. All the relevant variables will be replaced as in the header.html and footer.html files. The default nomatch.html is little more than header.html and footer.html appended:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>No match for '$&(LOGICAL_WORDS)'</title></head>
<body bgcolor="#eef7ff">
<h1><img src="/hldig/logo.jpg" alt="hl://Dig">
Search results</h1>
<hr noshade size="4">
<h2>No matches were found for '$&(LOGICAL_WORDS)'</h2>
<p>
Check the spelling of the search word(s) you used.
If the spelling is correct and you only used one word,
try using one or more similar search words with "<strong>Any</strong>."
</p><p>
If the spelling is correct and you used more than one
word with "<strong>Any</strong>," try using one or more similar search
words with "<strong>Any</strong>."</p><p>
If the spelling is correct and you used more than one
word with "<strong>All</strong>," try using one or more of the same words
with "<strong>Any</strong>."</p>
<hr noshade size="4">
<form method="get" action="$(CGI)">
<font size="-1">
<input type="hidden" name="config" value="$&(CONFIG)">
<input type="hidden" name="restrict" value="$&(RESTRICT)">
<input type="hidden" name="exclude" value="$&(EXCLUDE)">
Match: $(METHOD)
Format: $(FORMAT)
Sort by: $(SORT)
<br>
Refine search:
<input type="text" size="30" name="words" value="$&(WORDS)">
<input type="submit" value="Search">
</font>
</form>
<hr noshade size="4">
<a href="https://solbu.github.io/hldig/">
<img src="/hldig/logo.jpg" border="0" alt="hl://Dig">hl://Dig $(VERSION)</a>
</body></html>


${COMMON_DIR}/syntax.html

If a boolean expression search causes a syntax error, this file will be displayed.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Error in Boolean search for '$&(WORDS)'</title></head>
<body bgcolor="#eef7ff">
<h1><img src="/hldig/logo.jpg" alt="hl://Dig">
Error in Boolean search for '$&(LOGICAL_WORDS)'</h1>
<hr noshade size="4">
Boolean expressions need to be 'correct' in order for the search
system to use them.
The expression you entered has errors in it.<p>
Examples of correct expressions are: <strong>cat and dog</strong>, <strong>cat
not dog</strong>, <strong>cat or (dog not nose)</strong>.<br>Note that
the operator <strong>not</strong> has the meaning of 'without'.
<blockquote><strong>
$(SYNTAXERROR)
</strong></blockquote>
<hr noshade size="4">
<form method="get" action="$(CGI)">
<font size="-1">
<input type="hidden" name="config" value="$&(CONFIG)">
<input type="hidden" name="restrict" value="$&(RESTRICT)">
<input type="hidden" name="exclude" value="$&(EXCLUDE)">
Match: $(METHOD)
Format: $(FORMAT)
Sort: $(SORT)
<br>
Refine search:
<input type="text" size="30" name="words" value="$&(WORDS)">
<input type="submit" value="Search">
</font>
</form>
<hr noshade size="4">
<a href="https://solbu.github.io/hldig/">
<img src="/hldig/logo.jpg" border="0" alt="hl://Dig">hl://Dig $(VERSION)</a>
</body></html>