You are here

function drush_search_api_reindex in Search API 7

Mark for re-indexing.

File

./search_api.drush.inc, line 461
Drush commands for SearchAPI.

Code

function drush_search_api_reindex($index_id = NULL) {
  if (search_api_drush_static(__FUNCTION__)) {
    return;
  }
  $indexes = search_api_drush_get_index($index_id);
  if (empty($indexes)) {
    return;
  }

  // See search_api_index_reindex()
  foreach ($indexes as $index) {
    $index
      ->reindex();
    drush_log(dt('!index was successfully marked for re-indexing.', array(
      '!index' => $index->machine_name,
    )), 'ok');
  }
}