You are here

protected function SearchApiSolrBackend::getAutocompleteQuery in Search API Solr 8.2

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

Parameters

$incomplete_key:

$user_input:

Return value

AutocompleteQuery|null

Throws

\Drupal\search_api\SearchApiException

3 calls to SearchApiSolrBackend::getAutocompleteQuery()
SearchApiSolrBackend::getAutocompleteSuggestions in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Implements autocomplete compatible to AutocompleteBackendInterface.
SearchApiSolrBackend::getSpellcheckSuggestions in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Autocompletion suggestions for some user input using Spellcheck component.
SearchApiSolrBackend::getSuggesterSuggestions in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Autocompletion suggestions for some user input using Suggester component.

File

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

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function getAutocompleteQuery(&$incomplete_key, &$user_input) {

  // Make the input lowercase as the indexed data is (usually) also all
  // lowercase.
  $incomplete_key = mb_strtolower($incomplete_key);
  $user_input = mb_strtolower($user_input);
  $connector = $this
    ->getSolrConnector();
  $solr_version = $connector
    ->getSolrVersion();
  if (version_compare($solr_version, '6.5', '=')) {
    $this
      ->getLogger()
      ->error('Solr 6.5.x contains a bug that breaks the autocomplete feature. Downgrade to 6.4.x or upgrade to 6.6.x at least.');
    return NULL;
  }
  return $connector
    ->getAutocompleteQuery();
}