#331719 by chx: Fix search query that had a field aliased to one of its column names, causing problems in certain databases.

merge-requests/26/head
Angie Byron 2008-11-08 04:55:13 +00:00
parent 1632855a9f
commit 7aea369db5
1 changed files with 1 additions and 1 deletions

View File

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