You are here

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

Set the term parameters for the solarium autocomplete query.

Parameters

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

AutocompleteQuery $solarium_query: An autocomplete solarium query.

string $incomplete_key: The start of another fulltext keyword for the search, which should be completed.

1 call to SearchApiSolrBackend::setAutocompleteTermQuery()
SearchApiSolrBackend::getAutocompleteSuggestions in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Implements autocomplete compatible to AutocompleteBackendInterface.

File

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

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function setAutocompleteTermQuery(QueryInterface $query, AutocompleteQuery $solarium_query, $incomplete_key) {
  $fl = $this
    ->getAutocompleteFields($query);
  $terms_component = $solarium_query
    ->getTerms();
  $terms_component
    ->setFields($fl);
  $terms_component
    ->setPrefix($incomplete_key);
  $terms_component
    ->setLimit($query
    ->getOption('limit', 10));
}