From 03c18bb2042114d3a9a8b5396d77696cdff2a188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Thu, 3 Jan 2008 09:55:06 +0000 Subject: #205795 by douggreen: search result normalization used a wrong calculation --- modules/search/search.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') 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(); } -- cgit v1.2.3