I imported more than 3000 comments into one node (from my former perl driven guestbook; by inserting the comments via database inserts), now I cannot get Drupal to index my site, cron.php ends with a 500 error.

Is it because of the number of un-indexed comments?

Or maybe because of some missing attribute values in other database tables (adding comments works fine and everything looks good)?

I might have some encoding issues here, too, as I noticed some umlauts didn't make it correctly into the new site.

Any hints on how to get the node with the many comments indexed are very welcome (I'm ready to lay hands on the code, but wouldn't know where exactly right now) -- thanks in advance!

Comments

sillygwailo’s picture

Take a look at http://drupal.org/node/361171#comment-2758708 for debugging the search index to see which node it fails on. In the comment module, take a look at the comment_nodeapi() (specifically the 'update index' case) to see where Comment module does its search index updating.

I found this 4 year old post looking for info on how to index a node with 4000+ comments. Commenting out that the code in comment.module helped me get past indexing that node.

That is, in Drupal 6, change:

    case 'update index':
      $text = '';
      $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMM
ENT_PUBLISHED);
      while ($comment = db_fetch_object($comments)) {
        $text .= '<h2>'. check_plain($comment->subject) .'</h2>'. check_markup($comment->comment, $comment->format, FALSE);
      }
      return $text;

to

/*
    case 'update index':
      $text = '';
      $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMM
ENT_PUBLISHED);
      while ($comment = db_fetch_object($comments)) {
        $text .= '<h2>'. check_plain($comment->subject) .'</h2>'. check_markup($comment->comment, $comment->format, FALSE);
      }
      return $text;
*/

(Username formerly my full name, Richard Eriksson.)

brevity’s picture

Thanks for posting that! Currently not sure if my node in question still exists :D
Basically you disable indexing for comments, ok. I once wondered, does drupal direct the user to the corresponding comment when searching or just to the corresponding node? ...