You are here

function search_api_drush_command in Search API 7

Same name and namespace in other branches
  1. 8 search_api.drush.inc \search_api_drush_command()

Implements hook_drush_command().

File

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

Code

function search_api_drush_command() {
  $items = array();
  $items['search-api-list'] = array(
    'description' => 'List all search indexes.',
    'examples' => array(
      'drush searchapi-list' => dt('List all search indexes.'),
      'drush sapi-l' => dt('Alias to list all search indexes.'),
    ),
    'aliases' => array(
      'sapi-l',
    ),
  );
  $items['search-api-enable'] = array(
    'description' => 'Enable one or all disabled search_api indexes.',
    'examples' => array(
      'drush searchapi-enable' => dt('Enable all disabled indexes.'),
      'drush sapi-en' => dt('Alias to enable all disabled indexes.'),
      'drush sapi-en 1' => dt('Enable index with the ID !id.', array(
        '!id' => 1,
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index to enable.'),
    ),
    'aliases' => array(
      'sapi-en',
    ),
  );
  $items['search-api-disable'] = array(
    'description' => 'Disable one or all enabled search_api indexes.',
    'examples' => array(
      'drush searchapi-disable' => dt('Disable all enabled indexes.'),
      'drush sapi-dis' => dt('Alias to disable all enabled indexes.'),
      'drush sapi-dis 1' => dt('Disable index with the ID !id.', array(
        '!id' => 1,
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index to disable.'),
    ),
    'aliases' => array(
      'sapi-dis',
    ),
  );
  $items['search-api-status'] = array(
    'description' => 'Show the status of one or all search indexes.',
    'examples' => array(
      'drush searchapi-status' => dt('Show the status of all search indexes.'),
      'drush sapi-s' => dt('Alias to show the status of all search indexes.'),
      'drush sapi-s 1' => dt('Show the status of the search index with the ID !id.', array(
        '!id' => 1,
      )),
      'drush sapi-s default_node_index' => dt('Show the status of the search index with the machine name !name.', array(
        '!name' => 'default_node_index',
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index.'),
    ),
    'aliases' => array(
      'sapi-s',
    ),
  );
  $items['search-api-index'] = array(
    'description' => 'Index items for one or all enabled search_api indexes.',
    'examples' => array(
      'drush searchapi-index' => dt('Index items for all enabled indexes.'),
      'drush sapi-i' => dt('Alias to index items for all enabled indexes.'),
      'drush sapi-i 1' => dt('Index items for the index with the ID !id.', array(
        '!id' => 1,
      )),
      'drush sapi-i default_node_index' => dt('Index items for the index with the machine name !name.', array(
        '!name' => 'default_node_index',
      )),
      'drush sapi-i 1 100' => dt("Index a maximum number of !limit items (index's cron batch size items per batch run) for the index with the ID !id.", array(
        '!limit' => 100,
        '!id' => 1,
      )),
      'drush sapi-i 1 100 10' => dt("Index a maximum number of !limit items (!batch_size items per batch run) for the index with the ID !id.", array(
        '!limit' => 100,
        '!batch_size' => 10,
        '!id' => 1,
      )),
      'drush sapi-i 0 0 100' => dt("Index all items of all indexes with !batch_size items per batch run.", array(
        '!batch_size' => 100,
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index. Set to 0 to index all indexes. Defaults to 0 (index all).'),
      'limit' => dt("The number of items to index (index's cron batch size items per run). Set to 0 to index all items. Defaults to 0 (index all)."),
      'batch_size' => dt("The number of items to index per batch run. Set to 0 to index all items at once. Defaults to the index's cron batch size."),
    ),
    'aliases' => array(
      'sapi-i',
    ),
  );
  $items['search-api-reindex'] = array(
    'description' => 'Force reindexing of one or all search indexes, without clearing existing index data.',
    'examples' => array(
      'drush searchapi-reindex' => dt('Schedule all search indexes for reindexing.'),
      'drush sapi-r' => dt('Alias to schedule all search indexes for reindexing .'),
      'drush sapi-r 1' => dt('Schedule the search index with the ID !id for re-indexing.', array(
        '!id' => 1,
      )),
      'drush sapi-r default_node_index' => dt('Schedule the search index with the machine name !name for re-indexing.', array(
        '!name' => 'default_node_index',
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index.'),
    ),
    'aliases' => array(
      'sapi-r',
    ),
  );
  $items['search-api-reindex-items'] = array(
    'description' => 'Force re-indexing of one or more specific items.',
    'examples' => array(
      'drush search-api-reindex-items node 12,34,56' => dt('Schedule the nodes with ID 12, 34 and 56 for re-indexing.'),
    ),
    'arguments' => array(
      'entity_type' => dt('The entity type whose items should be re-indexed.'),
      'entities' => dt('The entities of the given entity type to be re-indexed.'),
    ),
    'aliases' => array(
      'sapi-ri',
    ),
  );
  $items['search-api-clear'] = array(
    'description' => 'Clear one or all search indexes and mark them for re-indexing.',
    'examples' => array(
      'drush searchapi-clear' => dt('Clear all search indexes.'),
      'drush sapi-c' => dt('Alias to clear all search indexes.'),
      'drush sapi-c 1' => dt('Clear the search index with the ID !id.', array(
        '!id' => 1,
      )),
      'drush sapi-c default_node_index' => dt('Clear the search index with the machine name !name.', array(
        '!name' => 'default_node_index',
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index.'),
    ),
    'aliases' => array(
      'sapi-c',
    ),
  );
  $items['search-api-execute-tasks'] = array(
    'description' => 'Execute all pending tasks or all for a given server.',
    'examples' => array(
      'drush search-api-execute-tasks my_solr_server' => dt('Execute all pending tasks on !server', array(
        '!server' => 'my_solr_server',
      )),
      'drush sapi-et my_solr_server' => dt('Execute all pending tasks on !server', array(
        '!server' => 'my_solr_server',
      )),
      'drush sapi-et' => dt('Execute all pending tasks on all servers.'),
    ),
    'arguments' => array(
      'server_id' => dt('The numeric ID or machine name of a server to execute tasks on.'),
    ),
    'aliases' => array(
      'sapi-et',
    ),
  );
  $items['search-api-set-index-server'] = array(
    'description' => 'Set the search server used by a given index.',
    'examples' => array(
      'drush search-api-set-index-server default_node_index my_solr_server' => dt('Set the !index index to use the !server server.', array(
        '!index' => 'default_node_index',
        '!server' => 'my_solr_server',
      )),
      'drush sapi-sis default_node_index my_solr_server' => dt('Alias to set the !index index to use the !server server.', array(
        '!index' => 'default_node_index',
        '!server' => 'my_solr_server',
      )),
    ),
    'arguments' => array(
      'index_id' => dt('The numeric ID or machine name of an index.'),
      'server_id' => dt('The numeric ID or machine name of a server to set on the index.'),
    ),
    'aliases' => array(
      'sapi-sis',
    ),
  );
  $items['search-api-server-list'] = array(
    'description' => 'List all search servers.',
    'examples' => array(
      'drush search-api-server-list' => dt('List all search servers.'),
      'drush sapi-sl' => dt('Alias to list all search servers.'),
    ),
    'aliases' => array(
      'sapi-sl',
    ),
  );
  $items['search-api-server-enable'] = array(
    'description' => 'Enable a search server.',
    'examples' => array(
      'drush search-api-server-e my_solr_server' => dt('Enable the !server search server.', array(
        '!server' => 'my_solr_server',
      )),
      'drush sapi-se my_solr_server' => dt('Alias to enable the !server search server.', array(
        '!server' => 'my_solr_server',
      )),
    ),
    'arguments' => array(
      'server_id' => dt('The numeric ID or machine name of a search server to enable.'),
    ),
    'aliases' => array(
      'sapi-se',
    ),
  );
  $items['search-api-server-disable'] = array(
    'description' => 'Disable a search server.',
    'examples' => array(
      'drush search-api-server-disable' => dt('Disable the !server search server.', array(
        '!server' => 'my_solr_server',
      )),
      'drush sapi-sd' => dt('Alias to disable the !server search server.', array(
        '!server' => 'my_solr_server',
      )),
    ),
    'arguments' => array(
      'server_id' => dt('The numeric ID or machine name of a search server to disable.'),
    ),
    'aliases' => array(
      'sapi-sd',
    ),
  );
  return $items;
}