diff options
-rw-r--r-- | modules/search/search.module | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/search/search.module b/modules/search/search.module index f1636106c..cff5a9872 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -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(); } |