According to Geoff Hutchison:
> Doing a quick Database lookup inside of parser.cc to get the DocIDs out of
> the index is probably the best solution.

OK, that was almost too easy.  The patch is below.  I'll commit it, because
it works for me (in fact it worked the first try, which is kinda scary for
something that originally seemed very complicated), but I'd appreciate a
few extra eyeballs on this code, or some other testers.  The weight is
essentially hard-coded as 1, because I didn't see the point in dragging
text_factor or some other attribute into this.

--- htsearch/htsearch.cc.orig   Thu Nov  1 14:45:07 2001
+++ htsearch/htsearch.cc        Fri Jan 18 13:37:35 2002
@@ -486,6 +486,10 @@ setupWords(char *allWords, List &searchW
                {
                    tempWords.Add(new WeightWord("!", -1.0));
                }
+               else if (strcmp(word.get(), prefix_suffix) == 0)
+               {
+                   tempWords.Add(new WeightWord(prefix_suffix, 1.0));
+               }
                else
                {
                    // Add word to excerpt matching list
--- htsearch/parser.cc.orig     Thu Jul 26 15:08:52 2001
+++ htsearch/parser.cc  Fri Jan 18 13:53:05 2002
@@ -224,6 +224,7 @@ void
 Parser::perform_push()
 {
     static int maximum_word_length = config.Value("maximum_word_length", 12);
+    static char        *prefix_suffix = config["prefix_match_character"];
     String     temp = current->word.get();
     String     data;
     char       *p;
@@ -238,6 +239,21 @@ Parser::perform_push()
        // This word needs to be ignored.  Make it so.
        //
        list->isIgnore = 1;
+       return;
+    }
+    if (strcmp(temp.get(), prefix_suffix) == 0) {
+       Database        *docIndex = Database::getDatabaseInstance();
+       docIndex->OpenRead(config["doc_index"]);
+       docIndex->Start_Get();
+       while ((p = docIndex->Get_Next()))
+       {
+           dm = new DocMatch;
+           dm->score = current->weight;
+           dm->id = atoi(p);
+           dm->anchor = 0;
+           list->add(dm);
+       }
+       delete docIndex;
        return;
     }
     temp.lowercase();

-- 
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

Reply via email to