hello people
        I am releasing a patch for choosing boolean keywords from
configuration file. The attribute should look like:

        boolean_keywords: and or not

        If you don't put anything it doesn't matter what is the default
value. For example i use:

        boolean_keywords: y o no

        The error messages are still in english. Any suggestions are
welcome and i expect that i did not break anything. ;)

        Normally, you should apply this patch after accents patch but it
does not really matter. just type "patch -p1 < ../bool_keywords.patch"
when you are in the source tree. Then configure, make, whatever.

        Hope it helps.
                                                Alexey
diff -rc htdig-3.1.5/htcommon/defaults.cc tmp/htdig-3.1.5/htcommon/defaults.cc
*** htdig-3.1.5/htcommon/defaults.cc    Thu May  4 16:20:38 2000
--- tmp/htdig-3.1.5/htcommon/defaults.cc        Thu May  4 15:53:04 2000
***************
*** 37,42 ****
--- 37,43 ----
      {"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"},
      {"bad_querystr",                    ""},
      {"bad_word_list",                 "${common_dir}/bad_words"},
+     {"boolean_keywords",              "and or not"},
      {"build_select_lists",            ""},
      {"case_sensitive",                  "true"},
      {"common_url_parts",                "http:// http://www. ftp:// ftp://ftp. /pub/ 
.html .htm .gif .jpg .jpeg /index.html /index.htm .com/ .com mailto:"},
***************
*** 167,170 ****
--- 168,175 ----
  };
  
  Configuration config;
+ 
+ 
+ 
+ 
  
diff -rc htdig-3.1.5/htsearch/htsearch.cc tmp/htdig-3.1.5/htsearch/htsearch.cc
*** htdig-3.1.5/htsearch/htsearch.cc    Thu May  4 16:20:38 2000
--- tmp/htdig-3.1.5/htsearch/htsearch.cc        Thu May  4 16:10:09 2000
***************
*** 48,53 ****
--- 48,76 ----
  int                   minimum_word_length = 3;
  
  
+ // boolean keywords are loaded in this function
+ // they should be placed in this order:
+ //    0       1       2
+ //    and     or      not
+ 
+ String boolean_keywords[3];
+ 
+ void load_boolean_keywords()
+ {
+     String temp=config["boolean_keywords"];
+     char *w=strtok(temp," \t");
+     int i=0;
+     while(w) {
+         boolean_keywords[i]=w;
+       boolean_keywords[i].lowercase();
+       w=strtok(NULL," \t");
+       i++;
+     }
+     if(i!=3) {
+         reportError("boolean_keywords is not correctly specified");
+     } 
+ }
+ 
  //*****************************************************************************
  // int main()
  //
***************
*** 202,207 ****
--- 225,233 ----
                         url_part_errors.get()));
  
      Parser    *parser = new Parser();
+ 
+     // Load boolean keywords from configuration
+     load_boolean_keywords();
        
      //
      // Parse the words to search for from the argument list.
***************
*** 305,315 ****
        if (!ww->isHidden)
        {
            if (strcmp(ww->word, "&") == 0 && wasHidden == 0)
!               logicalWords << " and ";
            else if (strcmp(ww->word, "|") == 0 && wasHidden == 0)
!               logicalWords << " or ";
            else if (strcmp(ww->word, "!") == 0 && wasHidden == 0)
!               logicalWords << " not ";
            else if (wasHidden == 0)
            {
                logicalWords << ww->word;
--- 331,341 ----
        if (!ww->isHidden)
        {
            if (strcmp(ww->word, "&") == 0 && wasHidden == 0)
!               logicalWords << " " << boolean_keywords[0] << " ";
            else if (strcmp(ww->word, "|") == 0 && wasHidden == 0)
!               logicalWords << " " << boolean_keywords[1] << " ";
            else if (strcmp(ww->word, "!") == 0 && wasHidden == 0)
!               logicalWords << " " << boolean_keywords[2] << " ";
            else if (wasHidden == 0)
            {
                logicalWords << ww->word;
***************
*** 409,423 ****
  
                pos--;
                word.lowercase();
!               if (boolean && mystrcasecmp(word.get(), "and") == 0)
                {
                    tempWords.Add(new WeightWord("&", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), "or") == 0)
                {
                    tempWords.Add(new WeightWord("|", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), "not") == 0)
                {
                    tempWords.Add(new WeightWord("!", -1.0));
                }
--- 435,449 ----
  
                pos--;
                word.lowercase();
!               if (boolean && mystrcasecmp(word.get(), boolean_keywords[0]) == 0)
                {
                    tempWords.Add(new WeightWord("&", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), boolean_keywords[1]) == 
0)
                {
                    tempWords.Add(new WeightWord("|", -1.0));
                }
!               else if (boolean && mystrcasecmp(word.get(), boolean_keywords[2]) == 
0)
                {
                    tempWords.Add(new WeightWord("!", -1.0));
                }
------------------------------------
To unsubscribe from the htdig mailing list, send a message to
[EMAIL PROTECTED]
You will receive a message to confirm this.

Reply via email to