Drupal 7 Search - Fails to Index

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
laughnan's picture

When I go to index the site (something that should theoretically be running during cron), it fails to index at all. Strangely, there is no error message given for a failed cron. I have installed "Disable Messaging", but logged in as the user/1 or even with the module deactivated it fails to report an error.

My thoughts:

  1. I installed a certain module that is blocking the search function
  2. There is suddenly an issue in the MySQL database
  3. Humans should be allowed to search in Drupal

Thoughts?

AttachmentSize
Screen Shot 2012-06-27 at 5.23.52 PM.png13.64 KB
Screen Shot 2012-06-27 at 5.24.02 PM.png24.94 KB
Screen Shot 2012-06-27 at 5.24.12 PM.png13.63 KB

Comments

Are you using the PHP input

jhedstrom's picture

Are you using the PHP input filter? I've seen this happen on sites where that is in use to, for instance, redirect a given node elsewhere. When that happens, and the node is being prepared for indexing, the php code is evaluated and cron exits unexpectedly.

I do have a block configured

laughnan's picture

I do have a block configured that runs PHP input. Is there a way to make the code more friendly so that cron runs with in currently on the page? I am going to remove that block, clear the cache, and then run cron to make sure that the site is indexed....

I have removed the block with

laughnan's picture

I have removed the block with the custom php and even disabled the php filter module...but even with the cache cleared, it will still not index the content. Thoughts?

What happens when you run

Tom.Camp's picture

What happens when you run cron manually? Can you check not only the Drupal logs, but the Apache logs as well?

When in doubt, go downhill.

if drupal_goto or any

Tom.Camp's picture

if drupal_goto or any other redirect method is causing the error, you can wrap the redirect in a conditional, checking the script that is running like so:

if ( $_SERVER[ 'SCRIPT_NAME' ] != '/cron.php' ) {
  do redirection
}

If it is a redirect that is causing the site to not index it should be obvious if you run cron manually as it will end on the page that is being redirected to (I think that is pretty poor grammar, but I think it gets the message across).

When in doubt, go downhill.

Hi @laughnan, If you want to

_vid's picture

Hi @laughnan,
If you want to track down the cause of your cron problems you can check out: Solving cron problems (http://drupal.org/node/553430). I had a similar problem last year and tried the suggestions in 'Advanced debugging', which helped immensely. I've tracked down several drupal_goto functions in both 3rd party modules and custom code that were tripping up the search index process.
Initially I used the same solution Tom.Camp recommended and that worked in most cases but fails for drush cron and a few other cases.
I just stumbled on to more comprehensive solution that checks for cron run via drush as well: http://drupal.org/node/102138#comment-6227782

@Tom.Camp and @_vid - sorry

laughnan's picture

@Tom.Camp and @_vid - sorry for the late reply! I implemented both of your suggestions and it worked! Thank you for your thoughts and I really appreciated the advice!

Hi, It's been a while but I

Bertjuh's picture

Hi,

It's been a while but I just had the same problem. Cron ran without errors but the search database did not index anything. I did all the things mentioned above
and found out that disabling the module 'search combine' solved the indexing problem.

The module was not the cause. If I set the standard search module (admin/config/search/settings) to User instead of Node, then the search did not index anything again. I have no clue what causes this problem, but I though I'd leave this here.