You are here

public function Search::setSuggesters in Search API Autocomplete 8

Sets this search's suggester plugins.

Parameters

\Drupal\search_api_autocomplete\Suggester\SuggesterInterface[] $suggesters: An array of suggesters.

Return value

$this

Overrides SearchInterface::setSuggesters

1 call to Search::setSuggesters()
Search::onDependencyRemoval in src/Entity/Search.php
Informs the entity that entities it depends on will be deleted.

File

src/Entity/Search.php, line 299

Class

Search
Describes the autocomplete settings for a certain search.

Namespace

Drupal\search_api_autocomplete\Entity

Code

public function setSuggesters(array $suggesters = NULL) {
  $this->suggesterInstances = $suggesters;

  // Sanitize the suggester weights and limits.
  $this->suggester_weights = array_intersect_key($this->suggester_weights, $suggesters);
  $this->suggester_limits = array_intersect_key($this->suggester_limits, $suggesters);
  return $this;
}