2

Search cron on my sites takes about 2-3 minutes, no matter how frequent I run it. I was under the impression only new nodes added since the last run get added to the index. Apparently it's working differently?

Would a SOLR search index update be quicker?

  • 1
    Can you give us some stats about your Drupal ? Like, how many nodes, comments, the size of your search index etc.. And accessory the list of modules that you've enabled. – yvan Sep 17 '12 at 16:57
  • turns out that somehow the index reset and now I have over 300k nodes in the index queue ... Rather than letting it index everything again I'll switch to SOLR now. Thanks everyone! – uwe Sep 17 '12 at 17:51
  • Creating a batch from a custom module that will invoke search_cron until it is finished is not a big deal, so if you need this I can post you the script. I'm saying because SOLR can take some time to setup/connect, especially if this is the first time you're doing it. – Aram Boyajyan Sep 17 '12 at 17:56
  • drush -y search-index – mpdonadio Sep 17 '12 at 18:20
  • I'm lucky, Pantheon already comes with SOLR installed, just have to enable and configure it. Looks pretty cool so far ... – uwe Sep 17 '12 at 23:09
1

Check how many nodes you are indexing per cron run. If the number is high, it will definitely take more time to process.

On the other hand, the search cron shouldn't take that long if there are no nodes to index. You can always check the number of not indexed nodes at search settings (admin/config/search/settings). If the number is 0 and search cron still takes that long, you might be having some problems or something else is causing the issue.

Take a look at Elysia cron for fine tuning when, how often and what is executed.

And regarding your last question - as far as I remember SOLR is doing that in the background - so yes, the search index update will be quicker.

[EDIT]

Thinking about this - it might have to do with the number of fields (because it invokes node_load on every node) and on the length of the body field.

| improve this answer | |
3

One quirk that I have run into is that everything that happens during a node_load and node_view happens during indexing. Take a look at _node_index_node start tracing backwards to see the process.

This means that any expensive operations that happen when a page gets viewed also happen when a page gets indexed.

For example, I had a site a while ago that queried an external webservice during node_load and I also noticed that search indexing was slow. In my instance, the external webservice calls were adding up and not needed during indexing. I solved it by doing something like

function foo_node_load ($nodes, $types)
{
  if (arg(0) != "node") return;

  // rest of hook
}

So, I would take a look at what else could be going on in your hooks and preprocess/process functions that could be slowing the process.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.