diff -rc htdig-3.1.5/htcommon/defaults.cc tmp/htdig-3.1.5/htcommon/defaults.cc *** htdig-3.1.5/htcommon/defaults.cc Fri May 5 11:59:52 2000 --- tmp/htdig-3.1.5/htcommon/defaults.cc Fri May 5 12:00:36 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 Fri May 5 11:59:52 2000 --- tmp/htdig-3.1.5/htsearch/htsearch.cc Fri May 5 12:00:58 2000 *************** *** 48,53 **** --- 48,78 ---- 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) { + if(i<3) { + 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 **** --- 227,235 ---- 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; --- 333,343 ---- 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)); } --- 437,451 ---- 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)); }