public function Search::getSuggester in Search API Autocomplete 8
Retrieves a specific suggester plugin for this search.
Parameters
string $suggester_id: The ID of the suggester plugin to return.
Return value
\Drupal\search_api_autocomplete\Suggester\SuggesterInterface The suggester plugin with the given ID.
Throws
\Drupal\search_api_autocomplete\SearchApiAutocompleteException Thrown if the specified suggester isn't enabled for this search, or couldn't be loaded.
Overrides SearchInterface::getSuggester
File
- src/
Entity/ Search.php, line 253
Class
- Search
- Describes the autocomplete settings for a certain search.
Namespace
Drupal\search_api_autocomplete\EntityCode
public function getSuggester($suggester_id) {
$suggesters = $this
->getSuggesters();
if (empty($suggesters[$suggester_id])) {
$index_label = $this
->label();
throw new SearchApiAutocompleteException("The suggester with ID '{$suggester_id}' could not be retrieved for index '{$index_label}'.");
}
return $suggesters[$suggester_id];
}