You are here

public function SearchApiServer::fieldsUpdated in Search API 7

Notifies the server that the field settings for the index have changed.

If the service class implementation of the method returns TRUE, this will automatically take care of marking the items on the index for re-indexing.

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::fieldsUpdated()

search_api_server_tasks_add()

File

includes/server_entity.inc, line 277
Contains SearchApiServer.

Class

SearchApiServer
Class representing a search server.

Code

public function fieldsUpdated(SearchApiIndex $index) {
  $this
    ->ensureProxy();
  try {
    if ($this->proxy
      ->fieldsUpdated($index)) {
      _search_api_index_reindex($index);
      return TRUE;
    }
  } catch (SearchApiException $e) {
    $vars = array(
      '%server' => $this->name,
      '%index' => $index->name,
    );
    watchdog_exception('search_api', $e, '%type while updating the fields of index %index on server %server: !message in %function (line %line of %file).', $vars);
    search_api_server_tasks_add($this, __FUNCTION__, $index, isset($index->original) ? $index->original : NULL);
  }
  return FALSE;
}