You are here

protected function SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions()
  2. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions()

Get the spellcheck suggestions from the autocomplete query result.

Parameters

\Solarium\Core\Query\Result\ResultInterface $result: An autocomplete query result.

\Drupal\search_api_autocomplete\Suggestion\SuggestionFactory $suggestion_factory: The suggestion factory.

Return value

\Drupal\search_api_autocomplete\Suggestion\SuggestionInterface[] An array of suggestions.

1 call to SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions()
SearchApiSolrBackend::getSpellcheckSuggestions in src/Plugin/search_api/backend/SearchApiSolrBackend.php

File

src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 3582

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function getAutocompleteSpellCheckSuggestions(ResultInterface $result, SuggestionFactory $suggestion_factory) {
  $suggestions = [];
  foreach ($this
    ->extractSpellCheckSuggestions($result) as $keys) {
    $suggestions[] = $suggestion_factory
      ->createFromSuggestedKeys(implode(' ', $keys));
  }
  return $suggestions;
}