You are here

function drush_search_api_index in Search API 8

Same name and namespace in other branches
  1. 7 search_api.drush.inc \drush_search_api_index()

Indexes items.

Parameters

string|null $index_id: (optional) The index ID for which items should be indexed, or NULL to index items on all indexes.

File

./search_api.drush.inc, line 302
Drush commands for Search API.

Code

function drush_search_api_index($index_id = NULL) {
  $command_helper = _search_api_drush_command_helper();
  $limit = drush_get_option('limit');
  $batch_size = drush_get_option('batch-size');
  $batch_set = $command_helper
    ->indexItemsToIndexCommand([
    $index_id,
  ], $limit, $batch_size);
  if ($batch_set) {
    drush_backend_batch_process();
  }
}