You are here

public function SearchApiServer::addIndex in Search API 7

Adds a new index to 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::addIndex()

search_api_server_tasks_add()

File

includes/server_entity.inc, line 250
Contains SearchApiServer.

Class

SearchApiServer
Class representing a search server.

Code

public function addIndex(SearchApiIndex $index) {
  $this
    ->ensureProxy();
  try {
    $this->proxy
      ->addIndex($index);
  } catch (SearchApiException $e) {
    $vars = array(
      '%server' => $this->name,
      '%index' => $index->name,
    );
    watchdog_exception('search_api', $e, '%type while adding index %index to server %server: !message in %function (line %line of %file).', $vars);
    search_api_server_tasks_add($this, __FUNCTION__, $index);
  }
}