You are here

function hook_search_api_solr_spellcheck_autocomplete_query_alter in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 search_api_solr.api.php \hook_search_api_solr_spellcheck_autocomplete_query_alter()
  2. 4.x search_api_solr.api.php \hook_search_api_solr_spellcheck_autocomplete_query_alter()

Lets modules alter the spellcheck autocomplete query before executing it.

Parameters

\Drupal\search_api_solr\Solarium\Autocomplete\Query $solarium_query: The Solarium query object, as generated from the Search API query.

\Drupal\search_api\Query\QueryInterface $query: The Search API query object representing the executed search query.

1 invocation of hook_search_api_solr_spellcheck_autocomplete_query_alter()
SearchApiSolrBackend::alterSpellcheckAutocompleteQuery in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Allow custom changes to the Solarium Spellcheck autocomplete query.

File

./search_api_solr.api.php, line 88
Hooks provided by the Search API Solr search module.

Code

function hook_search_api_solr_spellcheck_autocomplete_query_alter(\Drupal\search_api_solr\Solarium\Autocomplete\Query $solarium_query, \Drupal\search_api\Query\QueryInterface $query) {

  // If the Search API query has a 'spellcheck' component, set a custom
  // dictionary.
  $solarium_query
    ->getSpellcheck()
    ->setDictionary('custom');
}