You are here

public function SearchApiSolrBackend::getLanguageSpecificSolrFieldNames in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::getLanguageSpecificSolrFieldNames()

Gets a language-specific mapping from Drupal to Solr field names.

Parameters

string $language_id: The language to get the mapping for.

\Drupal\search_api\IndexInterface $index: The Search API index entity.

bool $reset: (optional) Whether to reset the static cache.

Return value

array The language-specific mapping from Drupal to Solr field names.

Throws

\Drupal\search_api\SearchApiException

Overrides SolrBackendInterface::getLanguageSpecificSolrFieldNames

5 calls to SearchApiSolrBackend::getLanguageSpecificSolrFieldNames()
SearchApiSolrBackend::extractResults in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Extract results from a Solr response.
SearchApiSolrBackend::getDocuments in src/Plugin/search_api/backend/SearchApiSolrBackend.php
SearchApiSolrBackend::getSolrFieldNames in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Creates a list of all indexed field names mapped to their Solr field names.
SearchApiSolrBackend::getSolrFieldNamesKeyedByLanguage in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Gets a language-specific mapping from Drupal to Solr field names.
SearchApiSolrBackend::removeIndex in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Removes an index from this server.

File

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

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

public function getLanguageSpecificSolrFieldNames($language_id, ?IndexInterface $index, $reset = FALSE) {
  static $field_names = [];
  if ($reset) {
    $field_names = [];
  }
  if ($index) {
    $index_id = $index
      ->id();
    if (!isset($field_names[$index_id]) || !isset($field_names[$index_id][$language_id])) {
      $field_names[$index_id][$language_id] = $this
        ->formatSolrFieldNames($language_id, $index);
    }
    return $field_names[$index_id][$language_id];
  }
}