I have a preference for a different 'similar entries' algorithm (below). Could the _similar_content function perhaps become theme_similar_content, so that it could be replaced if desired?

function _similar_content($node) {
  $text = implode(' ', array($node->title, $node->body));
  $result = db_query_range("SELECT r.nid, r.title, n.created, MATCH(r.body, r.title) AGAINST ('%s') AS score FROM {node_revisions} r INNER JOIN {node} n ON r.vid = n.vid WHERE MATCH(r.body, r.title) AGAINST ('%s') AND r.nid <> %d AND n.type = '%s' ORDER BY score DESC, n.created DESC", $text, $text, $node->nid, $node->type, 0, 10);

  $items = array(); 
  while ($node = db_fetch_object($result)) {
    if (! $first_score) $first_score = $node->score;  

    if (($first_score/$node->score) > 1.2) break;

    $items[] = l($node->title, 'node/'.$node->nid) . '<br/>' . format_interval(time() - $node->created, 1) . ' ago';
  }

  if (!empty($items)) return theme('item_list', $items);
}
CommentFileSizeAuthor
#1 similar_theme.patch985 byteshickory

Comments

hickory’s picture

Status: Active » Needs review
StatusFileSize
new985 bytes

Here's a tiny patch for the above.

deekayen’s picture

Status: Needs review » Fixed

Committed in CVS revision 1.7.2.3.

Anonymous’s picture

Status: Fixed » Closed (fixed)