I would like to expose apachesolr_cron to drush so I can control the rate of indexing myself, rather than just delegating that to the batch functions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ianthomas_uk’s picture

Title: Expose apachesolr_cron to drush » Allow indexing of a set number of items using drush
Status: Active » Needs review

Following discussion with nick_vh on IRC I have decided to implement this as an option for the existing drush solr-index command, rather than calling apachesolr_cron.

The attached patch also adds environment-id options to the solr-index, solr-delete-index and solr-mark-all commands

ianthomas_uk’s picture

The ATTACHED patch...

ianthomas_uk’s picture

The earlier patch was missing the extra parameter for apachesolr_index_batch_index_remaining

Nick_vh’s picture

Status: Needs review » Needs work

Super useful

Minor comment but critical enough

+++ b/apachesolr.admin.incundefined
@@ -980,8 +981,12 @@ function apachesolr_index_batch_index_remaining($env_id) {
+function apachesolr_index_batch_index_entities($env_id, $total_limit, &$context) {

breaking api?

ianthomas_uk’s picture

Good point, I'll look in to that. IIRC $context is added automatically by the batch API, so I can't just add $total_limit it as a third parameter.

Is it OK to change that function signature so long as old code using the batch API still works? (i.e. is the function itself considered part of the API, or only the exposure via batch API)

Nick_vh’s picture

yeah, as long as old code still works I'd be happy :)

Nick_vh’s picture

Status: Needs work » Needs review
FileSize
5.34 KB

Hmm, I did some searches and the only contrib module that needs altering is apachesolr_parallel
I would even be ok in changing this function as I expect almost no-one to alter the batch process, rather writing their own.

Nick_vh’s picture

Status: Needs review » Reviewed & tested by the community

RTBC

Nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 7.x-1.x, should commit to 6.x-3.x

pwolanin’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.