You are here

public function Spellcheck::getAutocompleteSuggestions in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/search_api_autocomplete/suggester/Spellcheck.php \Drupal\search_api_solr\Plugin\search_api_autocomplete\suggester\Spellcheck::getAutocompleteSuggestions()
  2. 4.x src/Plugin/search_api_autocomplete/suggester/Spellcheck.php \Drupal\search_api_solr\Plugin\search_api_autocomplete\suggester\Spellcheck::getAutocompleteSuggestions()

Throws

\Drupal\search_api\SearchApiException

\Drupal\search_api_autocomplete\SearchApiAutocompleteException

Overrides SuggesterInterface::getAutocompleteSuggestions

File

src/Plugin/search_api_autocomplete/suggester/Spellcheck.php, line 61

Class

Spellcheck
Provides a suggester plugin that retrieves suggestions from the server.

Namespace

Drupal\search_api_solr\Plugin\search_api_autocomplete\suggester

Code

public function getAutocompleteSuggestions(QueryInterface $query, $incomplete_key, $user_input) {
  if (!($backend = static::getBackend($this
    ->getSearch()
    ->getIndex()))) {
    return [];
  }
  return $backend
    ->getSpellcheckSuggestions($query, $this
    ->getSearch(), $incomplete_key, $user_input);
}