public function Terms::getAutocompleteSuggestions in Search API Solr 8.3
Same name and namespace in other branches
- 8.2 src/Plugin/search_api_autocomplete/suggester/Terms.php \Drupal\search_api_solr\Plugin\search_api_autocomplete\suggester\Terms::getAutocompleteSuggestions()
- 4.x src/Plugin/search_api_autocomplete/suggester/Terms.php \Drupal\search_api_solr\Plugin\search_api_autocomplete\suggester\Terms::getAutocompleteSuggestions()
Throws
\Drupal\search_api\SearchApiException
\Drupal\search_api_autocomplete\SearchApiAutocompleteException
Overrides Server::getAutocompleteSuggestions
File
- src/
Plugin/ search_api_autocomplete/ suggester/ Terms.php, line 27
Class
- Terms
- Provides a suggester that retrieves suggestions from Solr's Terms component.
Namespace
Drupal\search_api_solr\Plugin\search_api_autocomplete\suggesterCode
public function getAutocompleteSuggestions(QueryInterface $query, $incomplete_key, $user_input) {
if (!($backend = static::getBackend($this
->getSearch()
->getIndex()))) {
return [];
}
if ($this->configuration['fields']) {
$query
->setFulltextFields($this->configuration['fields']);
}
else {
$query
->setFulltextFields($query
->getIndex()
->getFulltextFields());
}
return $backend
->getAutocompleteSuggestions($query, $this
->getSearch(), $incomplete_key, $user_input);
}