We wanted the ability to present recommended links in
response to our most frequent searches and I didn't see
any option like that existing or in development.  So I
tweaked some of the ht:Dig code a bit and tried to make
my changes as minimal as possible to have the least
impact on the rest of the code.

The attached patch is against version 3.1.5 files,
use at your own risk.  Please see the COPYING file
distributed with ht:Dig for copying information.

There is also a very ugly page at:
http://www.kayakero.net/xfer/htdig/
with a link to download the complete changed source
files (as this was my first patch, I'm not sure how
well it will work -- it appears correct).

I added 5 configuration options:
force_results:                  use recommended links
force_results_db:               recommended link database
force_results_file:             human readable recommended links 
force_results_template:         recommended link template
force_results_case_sensitive:   case sensitive recommended links

I added a ForceDB class and a function to both htmerge and htsearch.

The idea is for htmerge to read force_results_file (formatted as:
<search term>: <url>
and convert that to a Berkeley database of DocMatch id and url
indexed by search term.  Then htsearch looks up the search term
in the database and grabs the recommended link (if there is one).
That link is then given a score 10% higher than the next highest
to force it to the top of the list.

If force_results_template is set, htsearch will add a 
template_patterns entry for the full recommended link
url using the force_results_template as the template.

For our purposes, that seems to do all we want.  One enhancement I've
thought of is to allow each recommended link to use it's own
template by storing that as well in the force_results_db database.

It might also be nice to be able to treat the recommended link term
as a potential substring of the actual terms searched for.  That would
also open the option of multiple recommended links returned for a
single search, which may or may not be desired.


-David Williams ([EMAIL PROTECTED])

force_results.patch.gz

Reply via email to