You are here

public function Query::setSearchId in Search API 8

Sets the search ID.

The search ID is a freely-chosen machine name identifying this search query for purposes of identifying the query later in the page request. It will be used, amongst other things, to identify the query in the search results cache service.

If the set ID is the same as a display plugin ID, this will also automatically set that display plugin for this query. Queries for the same display or search page should therefore usually use the same search ID.

Parameters

string $search_id: The new search ID.

Return value

$this

Overrides QueryInterface::setSearchId

See also

\Drupal\search_api\Query\QueryInterface::getDisplayPlugin()

\Drupal\search_api\Query\ResultsCacheInterface

File

src/Query/Query.php, line 362

Class

Query
Provides a standard implementation for a Search API query.

Namespace

Drupal\search_api\Query

Code

public function setSearchId($search_id) {
  $this->searchId = $search_id;
  return $this;
}