From 20295998e7a14ff708a33572e860e0587aaa82c3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 2 Dec 2008 21:24:34 +0000 Subject: - Patch #296624 by Damien Tournoud: made search work on PostgreSQL. --- modules/node/node.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index bf528cdf9..7204e9f2a 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1229,7 +1229,7 @@ function _node_rankings() { } // Add the rankings weighted score multiplier value, handling NULL gracefully. - $rankings['score'][] = '%f * COALESCE(('. $values['score'] .'), 0)'; + $rankings['score'][] = 'CAST(%f AS DECIMAL) * COALESCE(('. $values['score'] .'), 0)'; // Add the the administrator's weighted score multiplier value for this ranking. $rankings['total'] += $node_rank; @@ -1333,13 +1333,13 @@ function node_search($op = 'search', $keys = NULL) { $total = 1; $arguments2 = array(); $join2 = ''; - $select2 = 'i.relevance AS calculated_score'; + $select2 = 'SUM(i.relevance) AS calculated_score'; } else { $total = $rankings['total']; $arguments2 = $rankings['arguments']; $join2 = implode(' ', $rankings['join']); - $select2 = '('. implode(' + ', $rankings['score']) .') AS calculated_score'; + $select2 = 'SUM('. implode(' + ', $rankings['score']) .') AS calculated_score'; } // Do search. @@ -1405,7 +1405,7 @@ function node_ranking() { $ranking['recent'] = array( 'title' => t('Recently posted'), // Exponential decay with half-life of 6 months, starting at last indexed node - 'score' => '(POW(2, GREATEST(n.created, n.changed) - %d) * 6.43e-8)', + 'score' => 'POW(2.0, (GREATEST(n.created, n.changed) - %d) * 6.43e-8)', 'arguments' => array($node_cron_last), ); } -- cgit v1.2.3