You are here

public function SearchApiIndex::server in Search API 7

Get the server this index lies on.

Parameters

$reset: Whether to reset the internal cache. Set to TRUE when the index' $server property has just changed.

Return value

SearchApiServer The server associated with this index, or NULL if this index currently doesn't lie on a server.

Throws

SearchApiException If $this->server is set, but no server with that machine name exists.

2 calls to SearchApiIndex::server()
SearchApiIndex::postCreate in includes/index_entity.inc
Execute necessary tasks for a newly created index.
SearchApiIndex::postDelete in includes/index_entity.inc
Execute necessary tasks when the index is removed from the database.

File

includes/index_entity.inc, line 412
Contains SearchApiIndex.

Class

SearchApiIndex
Class representing a search index.

Code

public function server($reset = FALSE) {
  if (!isset($this->server_object) || $reset) {
    $this->server_object = $this->server ? search_api_server_load($this->server) : FALSE;
    if ($this->server && !$this->server_object) {
      throw new SearchApiException(t('Unknown server @server specified for index @name.', array(
        '@server' => $this->server,
        '@name' => $this->machine_name,
      )));
    }
  }
  return $this->server_object ? $this->server_object : NULL;
}