You are here

protected function SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::getAutocompleteSpellCheckSuggestions()
  2. 8.2 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 3783

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 $spellcheck_suggestions) {
    foreach ($spellcheck_suggestions as $keys) {
      $suggestions[] = $suggestion_factory
        ->createFromSuggestedKeys($keys);
    }
  }
  return $suggestions;
}