Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.642
diff -u -F^f -r1.642 comment.module
--- modules/comment/comment.module	3 Jul 2008 17:57:03 -0000	1.642
+++ modules/comment/comment.module	8 Jul 2008 15:13:34 -0000
@@ -581,23 +581,26 @@ function comment_nodeapi(&$node, $op, $a
 
     case 'update index':
       $text = '';
-      $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
-      while ($comment = db_fetch_object($comments)) {
-        $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, FALSE);
+      if ($node->comment != COMMENT_NODE_DISABLED) {      
+        $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
+        while ($comment = db_fetch_object($comments)) {
+          $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, FALSE);
+        }
       }
       return $text;
 
     case 'search result':
-      $comments = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $node->nid));
-      return format_plural($comments, '1 comment', '@count comments');
+      if ($node->comment != COMMENT_NODE_DISABLED) {    
+        $comments = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $node->nid));
+        return format_plural($comments, '1 comment', '@count comments');
+      }
+      return '';
 
     case 'rss item':
       if ($node->comment != COMMENT_NODE_DISABLED) {
         return array(array('key' => 'comments', 'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))));
       }
-      else {
-        return array();
-      }
+      return array();
   }
 }
 
