Commit 7aea369d authored by webchick's avatar webchick
Browse files

#331719 by chx: Fix search query that had a field aliased to one of its column...

#331719 by chx: Fix search query that had a field aliased to one of its column names, causing problems in certain databases.
parent 1632855a
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment