You are here

protected function SearchApiSolrBackend::setAutocompleteSpellCheckQuery 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::setAutocompleteSpellCheckQuery()
  2. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::setAutocompleteSpellCheckQuery()

Set the spellcheck parameters for the solarium autocomplete query.

Parameters

\Drupal\search_api\Query\QueryInterface $query: A query representing the completed user input so far.

\Drupal\search_api_solr\Solarium\Autocomplete\Query $solarium_query: A Solarium autocomplete query.

string $user_input: The user input.

Throws

\Drupal\search_api_solr\SearchApiSolrException

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

File

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

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function setAutocompleteSpellCheckQuery(QueryInterface $query, AutocompleteQuery $solarium_query, $user_input) {
  $this
    ->setSpellcheck($solarium_query, $query, [
    'keys' => [
      $user_input,
    ],
    'count' => $query
      ->getOption('limit') ?? 1,
  ]);
}