You are here

public function SearchApiServer::removeIndex in Search API 7

Removes an index from this server.

If an exception in the service class implementation of this method occurs, it will be caught and the operation saved as an pending server task.

See also

SearchApiServiceInterface::removeIndex()

search_api_server_tasks_add()

File

includes/server_entity.inc, line 305
Contains SearchApiServer.

Class

SearchApiServer
Class representing a search server.

Code

public function removeIndex($index) {

  // When removing an index from a server, it doesn't make any sense anymore to
  // delete items from it, or react to other changes.
  search_api_server_tasks_delete(NULL, $this, $index);
  $this
    ->ensureProxy();
  try {
    $this->proxy
      ->removeIndex($index);
  } catch (SearchApiException $e) {
    $vars = array(
      '%server' => $this->name,
      '%index' => is_object($index) ? $index->name : $index,
    );
    watchdog_exception('search_api', $e, '%type while removing index %index from server %server: !message in %function (line %line of %file).', $vars);
    search_api_server_tasks_add($this, __FUNCTION__, $index);
  }
}