You are here

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

Get the fields to search for autocomplete terms.

Parameters

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

Return value

array

1 call to SearchApiSolrBackend::getAutocompleteFields()
SearchApiSolrBackend::setAutocompleteTermQuery in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Set the term parameters for the solarium autocomplete query.
1 method overrides SearchApiSolrBackend::getAutocompleteFields()
AbstractSearchApiSolrMultilingualBackend::getAutocompleteFields in src/Plugin/search_api/backend/AbstractSearchApiSolrMultilingualBackend.php
Get the fields to search for autocomplete terms.

File

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

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function getAutocompleteFields(QueryInterface $query) {
  $fl = [];
  $solr_field_names = $this
    ->getSolrFieldNames($query
    ->getIndex());

  // We explicit allow to get terms from twm_suggest. Therefore we call
  // parent::getQueryFulltextFields() to not filter twm_suggest.
  $fulltext_fields = parent::getQueryFulltextFields($query);
  foreach ($fulltext_fields as $fulltext_field) {
    $fl[] = $solr_field_names[$fulltext_field];
  }
  return array_unique($fl);
}