With the URL Rewrite patch in place, it was extremely easy to add a similar rewriting capability into htsearch, as had been discussed months ago, to give more flexibility in rewriting search result URLs than url_part_aliases gives. Here's a patch that adds a search_rewrite_rules attribute to htsearch, for this very purpose. It uses a different name than the url_rewrite_rules attribute, to avoid any conflicts if you use the same config file for htdig and htsearch.
This patch should apply cleanly to last Sunday's 3.1.6 snapshot, after you apply yesterday's URL Rewrite patch, using "patch -p0 < this-message" in the main source directory. I guess we still need to document both of these attributes, and add them to htcommon/defaults.cc. I'll try to get to that by Friday. --- htsearch/Display.cc.norewrite Tue Jul 24 16:01:01 2001 +++ htsearch/Display.cc Thu Sep 27 10:21:36 2001 @@ -22,6 +22,7 @@ static char RCSid[] = "$Id: Display.cc,v #include <syslog.h> #include <locale.h> #include "HtURLCodec.h" +#include "HtURLRewriter.h" #include "HtWordType.h" extern int debug; @@ -239,6 +240,7 @@ Display::displayMatch(ResultMatch *match char *coded_url = match->getURL(); String url = HtURLCodec::instance()->decode(coded_url); + HtURLRewriter::instance()->Replace(url); vars.Add("URL", new String(url.get())); int iA = ref->DocAnchor(); @@ -1297,6 +1299,7 @@ Display::buildMatchList() // No special precations re: the option // "uncoded_db_compatible" needs to be taken. url = HtURLCodec::instance()->decode(coded_url); + HtURLRewriter::instance()->Replace(url); if (!includeURL(url.get())) { continue; --- htsearch/htsearch.cc.norewrite Sun Sep 9 07:45:15 2001 +++ htsearch/htsearch.cc Thu Sep 27 10:20:37 2001 @@ -25,6 +25,7 @@ static char RCSid[] = "$Id: htsearch.cc, #include <ctype.h> #include <signal.h> #include "HtURLCodec.h" +#include "HtURLRewriter.h" #include "HtWordType.h" // If we have this, we probably want it. @@ -241,6 +242,13 @@ main(int ac, char **av) if (url_part_errors.length() != 0) reportError(form("Invalid url_part_aliases or common_url_parts: %s", + url_part_errors.get())); + + // for htsearch, we use search_rewrite_rules attribute for HtURLRewriter. + config.AddParsed("url_rewrite_rules", "${search_rewrite_rules}"); + url_part_errors = HtURLRewriter::instance()->ErrMsg(); + if (url_part_errors.length() != 0) + reportError(form("Invalid url_rewrite_rules: %s", url_part_errors.get())); // Load boolean_keywords from configuration -- Gilles R. Detillieux E-mail: <[EMAIL PROTECTED]> Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/~grdetil Dept. Physiology, U. of Manitoba Phone: (204)789-3766 Winnipeg, MB R3E 3J7 (Canada) Fax: (204)789-3930 _______________________________________________ htdig-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/htdig-dev