htdig: prefix matching now works


Jerry Preeper (preeper@cts.com)
Fri, 25 Sep 1998 15:37:49 -0700


Just wanted everyone to know I was finally able to get prefix matching to
work under 3.1.0b1 using proper capitalization as well as upper case words
thanks to Esa. The stock version currently seems to only work with all
lower case prefix matching. I have it working fine using a trailing
asterisk as the prefix matching character.

Esa supplied me with the following patch to Prefix.cc to enable this and I
would like to make it available to anyone else who might find it useful, so
here it is.

If it can be added to the next release, I think that would also be helpful.

Jerry Preeper
preeper@cts.com

--- htdig-3.1.0b1/htfuzzy/Prefix.cc Mon Sep 7 23:29:55 1998
+++ htdig.esa/htfuzzy/Prefix.cc Thu Sep 24 11:09:46 1998
@@ -64,7 +57,7 @@
     int minimum_prefix_length = config.Value("minimum_prefix_length");
 
     if (debug)
- cout << " word=" << w << " prefix_suffix=" << prefix_suffix
+ cerr << " word=" << w << " prefix_suffix=" << prefix_suffix
                 << " prefix_suffix_length=" << prefix_suffix_length
                 << " minimum_prefix_length=" << minimum_prefix_length << "\n";
 
@@ -92,11 +85,13 @@
     strncpy(w2, w, sizeof(w2) - 1);
     w2[sizeof(w2) - 1] = '\0';
     w2[strlen(w2) - prefix_suffix_length] = '\0';
- dbf->Start_Seq(w2);
+ String w3 = new String(w2);
+ w3.lowercase();
+ dbf->Start_Seq(w3.get());
 
     while (wordCount < maximumWords && (s = dbf->Get_Next_Seq()))
     {
- if (strncmp(s, w, len))
+ if (strncasecmp(s, w, len))
             break;
         words.Add(new String(s));
         wordCount++;

----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.



This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:27:52 PST