Branch: Tag:

2001-06-01

2001-06-01 09:30:01 by David Norlin <norlin@roxen.com>

Fixed a bug that shuffled the order of the query words.

Rev: lib/modules/Search.pmod/Query.pmod:1.9

9:    };   }    + static array(string) uniq_preserve_order(array(string) a) { +  array(string) result = ({}); +  foreach (a, string s) +  if (search(result, s) < 0) +  result += ({ s }); +  return result; + }      Search.ResultSet do_query_or(Search.Database.Base db,    array(string) words,    Search.RankingProfile ranking)   { -  array(int) word_ids=map(Array.uniq(words), db->hash_word); +  array(int) word_ids=map(uniq_preserve_order(words), db->hash_word);    Search.ResultSet result =    _WhiteFish.do_query_or(word_ids,    ranking->field_ranking,
29:    array(string) words,    Search.RankingProfile ranking)   { -  array(int) word_ids=map(Array.uniq(words), db->hash_word); +  array(int) word_ids=map(uniq_preserve_order(words), db->hash_word);    Search.ResultSet result =    _WhiteFish.do_query_and(word_ids,    ranking->field_ranking,
207:    if (hasPlus && hasOrdinary) {    Search.ResultSet r2 = pop();    Search.ResultSet r1 = pop(); -  push(r1->add(r2)); +  // If a document contains must-have words AND ALSO may-have words, +  // it's ranking is increased. +  push(r1->add_ranking(r2));    }       if ((hasPlus || hasOrdinary) && hasMinus) {