diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-12-02 21:24:34 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-12-02 21:24:34 +0000 |
commit | 20295998e7a14ff708a33572e860e0587aaa82c3 (patch) | |
tree | e6ea9c7237bdf668f2580d9039dbe03f0b04bc73 /modules/node/node.module | |
parent | 99afbc53a736ba30b294ed62611767345fe8c3dd (diff) | |
download | brdo-20295998e7a14ff708a33572e860e0587aaa82c3.tar.gz brdo-20295998e7a14ff708a33572e860e0587aaa82c3.tar.bz2 |
- Patch #296624 by Damien Tournoud: made search work on PostgreSQL.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r-- | modules/node/node.module | 8 |
1 files changed, 4 insertions, 4 deletions
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), ); } |