You are here

public function SearchApiCommands::clear in Search API 8

Clears one or all search indexes and marks them for reindexing.

@command search-api:clear

@usage drush search-api:clear Clear all search indexes. @usage drush sapi-c Alias to clear all search indexes. @usage drush sapi-c node_index Clear the search index with the ID node_index.

@aliases sapi-c,search-api-clear

Parameters

string $indexId: The machine name of an index. Optional. If missed all search indexes will be cleared.

Throws

\Drupal\search_api\SearchApiException Thrown if one of the affected indexes had an invalid tracker set, or some other internal error occurred.

File

src/Commands/SearchApiCommands.php, line 326

Class

SearchApiCommands
Defines Drush commands for the Search API.

Namespace

Drupal\search_api\Commands

Code

public function clear($indexId = NULL) {
  $this->commandHelper
    ->clearIndexCommand([
    $indexId,
  ]);
}