#205795 by douggreen: search result normalization used a wrong calculation
parent
18d46e4733
commit
03c18bb204
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue