You are here

function apachesolr_drush_command in Apache Solr Search 6

Same name and namespace in other branches
  1. 8 drush/apachesolr.drush.inc \apachesolr_drush_command()
  2. 5.2 apachesolr.drush.inc \apachesolr_drush_command()
  3. 6.3 drush/apachesolr.drush.inc \apachesolr_drush_command()
  4. 6.2 drush/apachesolr.drush.inc \apachesolr_drush_command()
  5. 7 drush/apachesolr.drush.inc \apachesolr_drush_command()

Implementation of hook_drush_command().

In this hook, you specify which commands your drush module makes available, what it does and description.

Notice how this structure closely resembles how you define menu hooks.

@See drush_parse_command() for a list of recognized keys.

Return value

An associative array describing your command(s).

File

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

Code

function apachesolr_drush_command() {
  $items = array();

  // the key in the $items array is the name of the command.
  $items['solr-delete-index'] = array(
    // the name of the function implementing your command.
    'callback' => 'apachesolr_drush_solr_delete_index',
    // a short description of your command
    'description' => dt('Deletes the content from the index. Can take content types as parameters.'),
    'arguments' => array(
      'types' => dt('Optional. A space delimited list of content types to be deleted from the index.'),
    ),
  );
  $items['solr-reindex'] = array(
    // the name of the function implementing your command.
    'callback' => 'apachesolr_drush_solr_reindex',
    // a short description of your command
    'description' => dt('Marks content for reindexing. Can take content types as parameters.'),
    'arguments' => array(
      'types' => dt('Optional. A space delimited list of content types to be marked for reindexing.'),
    ),
  );
  $items['solr-index'] = array(
    // the name of the function implementing your command.
    'callback' => 'apachesolr_drush_solr_index',
    // a short description of your command
    'description' => dt('Send to Solr content marked for (re)indexing. Same as running cron once but without the other overhead.'),
  );
  $items['solr-search'] = array(
    'callback' => 'apachesolr_drush_solr_search',
    'description' => dt('Search the site for keywords using Apache Solr'),
    'arguments' => array(
      'keywords' => dt('One or more keywords, separated by spaces.'),
    ),
  );
  return $items;
}