You are here

function apachesolr_drush_solr_index in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 drush/apachesolr.drush.inc \apachesolr_drush_solr_index()
  2. 6 drush/apachesolr.drush.inc \apachesolr_drush_solr_index()
  3. 6.2 drush/apachesolr.drush.inc \apachesolr_drush_solr_index()
  4. 7 drush/apachesolr.drush.inc \apachesolr_drush_solr_index()

Index all the items in the queue using a batch command

1 string reference to 'apachesolr_drush_solr_index'
apachesolr_drush_command in drush/apachesolr.drush.inc
Implements hook_drush_command().

File

drush/apachesolr.drush.inc, line 268
drush integration for apachesolr.

Code

function apachesolr_drush_solr_index() {
  module_load_include('inc', 'apachesolr', 'apachesolr.admin');
  module_load_include('inc', 'apachesolr', 'apachesolr.index');
  $front = url(NULL, array(
    'absolute' => TRUE,
  ));
  if ($front == 'http://default') {
    drush_set_error('APACHESOLR_ERROR', 'You must set the site uri via the -l (or --uri) option so that links are correctly indexed');
    return;
  }
  $env_id = drush_get_option('environment-id');
  if (empty($env_id)) {
    $env_id = apachesolr_default_environment();
  }
  $total_limit = intval(drush_get_option('limit'));
  apachesolr_index_batch_index_remaining($env_id, $total_limit);
  drush_backend_batch_process();
}