Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.776.2.6 diff -u -F^f -r1.776.2.6 node.module --- modules/node/node.module 14 Mar 2007 21:41:29 -0000 1.776.2.6 +++ modules/node/node.module 29 Mar 2007 21:59:39 -0000 @@ -867,13 +867,19 @@ function node_search($op = 'search', $ke // Used to avoid joining on node_comment_statistics twice $stats_join = FALSE; $total = 0; - if ($weight = (int)variable_get('node_rank_relevance', 5)) { + $weight = $_SESSION['node_rank_relevance']; + unset($_SESSION['node_rank_relevance']); + $weight = empty($weight) ? (int)variable_get('node_rank_relevance', 5) : $weight; + if ($weight) { // Average relevance values hover around 0.15 $ranking[] = '%d * i.relevance'; $arguments2[] = $weight; $total += $weight; } - if ($weight = (int)variable_get('node_rank_recent', 5)) { + $weight = $_SESSION['node_rank_recent']; + unset($_SESSION['node_rank_recent']); + $weight = empty($weight) ? (int)variable_get('node_rank_recent', 5) : $weight; + if ($weight) { // 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)'; $arguments2[] = $weight; @@ -882,26 +888,35 @@ function node_search($op = 'search', $ke $stats_join = TRUE; $total += $weight; } - 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))'; - $arguments2[] = $weight; - $arguments2[] = $scale; - if (!$stats_join) { - $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid'; + if (module_exists('comment')) { + $weight = $_SESSION['node_rank_comments']; + unset($_SESSION['node_rank_comments']); + $weight = empty($weight) ? (int)variable_get('node_rank_comments', 5) : $weight; + if ($weight) { + // 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))'; + $arguments2[] = $weight; + $arguments2[] = $scale; + if (!$stats_join) { + $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid'; + } + $total += $weight; } - $total += $weight; } - if (module_exists('statistics') && variable_get('statistics_count_content_views', 0) && - $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))'; - $arguments2[] = $weight; - $arguments2[] = $scale; - $join2 .= ' LEFT JOIN {node_counter} nc ON nc.nid = i.sid'; - $total += $weight; + if (module_exists('statistics') && variable_get('statistics_count_content_views', 0)) { + $weight = $_SESSION['node_rank_views']; + unset($_SESSION['node_rank_views']); + $weight = empty($weight) ? (int)variable_get('node_rank_views', 5) : $weight; + if ($weight) { + // 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))'; + $arguments2[] = $weight; + $arguments2[] = $scale; + $join2 .= ' LEFT JOIN {node_counter} nc ON nc.nid = i.sid'; + $total += $weight; + } } $select2 = (count($ranking) ? implode(' + ', $ranking) : 'i.relevance') .' AS score'; @@ -2523,6 +2538,20 @@ function node_form_alter($form_id, &$for '#suffix' => '', '#options' => $types, ); + + // Grab the administration form from node_search + $factors = node_search('admin'); + + // Get rid of the help text because it takes up too much space + unset($factors['content_ranking']['info']); + + // Get rid of the fieldset + $form['advanced']['factors'] = $factors['content_ranking']['factors']; + + // Wrap the form elements in a div to hold them together. + $form['advanced']['factors']['#prefix'] = '