You are here

function search_api_drush_get_index in Search API 7

Returns an index or all indexes as an array.

Parameters

string|int|null $index_id: (optional) The ID or machine name of the index to load. Defaults to loading all available indexes.

Return value

SearchApiIndex[] An array of indexes.

7 calls to search_api_drush_get_index()
drush_search_api_clear in ./search_api.drush.inc
Clear an index.
drush_search_api_disable in ./search_api.drush.inc
Disable index(es).
drush_search_api_enable in ./search_api.drush.inc
Enable index(es).
drush_search_api_index in ./search_api.drush.inc
Index items.
drush_search_api_reindex in ./search_api.drush.inc
Mark for re-indexing.

... See full list

File

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

Code

function search_api_drush_get_index($index_id = NULL) {
  $ids = isset($index_id) ? array(
    $index_id,
  ) : FALSE;
  $indexes = search_api_index_load_multiple($ids);
  if (empty($indexes)) {
    drush_set_error(dt('Invalid index_id or no indexes present. Listing all indexes:'));
    drush_print();
    drush_search_api_list();
  }
  return $indexes;
}