#205795 by douggreen: search result normalization used a wrong calculation

6.x
Gábor Hojtsy 2008-01-03 09:55:06 +00:00
parent 18d46e4733
commit 03c18bb204
1 changed files with 2 additions and 2 deletions

View File

@ -926,9 +926,9 @@ function do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = a
}
// Calculate maximum keyword relevance, to normalize it.
$select = "SELECT MAX(i.score * t.count) FROM {search_index} i $join WHERE $conditions GROUP BY i.type, i.sid HAVING COUNT(*) >= %d";
$select = "SELECT SUM(i.score * t.count) AS score FROM {search_index} i $join WHERE $conditions GROUP BY i.type, i.sid HAVING COUNT(*) >= %d ORDER BY score DESC";
$arguments = array_merge($arguments1, array($query[4]));
$normalize = db_result(db_query($select, $arguments));
$normalize = db_result(db_query_range($select, $arguments, 0, 1));
if (!$normalize) {
return array();
}