diff options
-rw-r--r-- | modules/node/node.module | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 661a0c608..2e331c471 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1185,7 +1185,7 @@ function node_search($op = 'search', $keys = NULL) { } if ($weight = (int)variable_get('node_rank_recent', 5)) { // Exponential decay with half-life of 6 months, starting at last indexed node - $ranking[] = '%d * POW(2, (GREATEST(n.created, n.changed, c.last_comment_timestamp) - %d) * 6.43e-8)'; + $ranking[] = '%d * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp)) - %d) * 6.43e-8)'; $arguments2[] = $weight; $arguments2[] = (int)variable_get('node_cron_last', 0); $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid'; @@ -1195,7 +1195,7 @@ function node_search($op = 'search', $keys = NULL) { if (module_exists('comment') && $weight = (int)variable_get('node_rank_comments', 5)) { // Inverse law that maps the highest reply count on the site to 1 and 0 to 0. $scale = variable_get('node_cron_comments_scale', 0.0); - $ranking[] = '%d * (2.0 - 2.0 / (1.0 + c.comment_count * %f))'; + $ranking[] = '%d * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * %f))'; $arguments2[] = $weight; $arguments2[] = $scale; if (!$stats_join) { @@ -1207,7 +1207,7 @@ function node_search($op = 'search', $keys = NULL) { $weight = (int)variable_get('node_rank_views', 5)) { // Inverse law that maps the highest view count on the site to 1 and 0 to 0. $scale = variable_get('node_cron_views_scale', 0.0); - $ranking[] = '%d * (2.0 - 2.0 / (1.0 + nc.totalcount * %f))'; + $ranking[] = '%d * (2.0 - 2.0 / (1.0 + MAX(nc.totalcount) * %f))'; $arguments2[] = $weight; $arguments2[] = $scale; $join2 .= ' LEFT JOIN {node_counter} nc ON nc.nid = i.sid'; |