You are here

public static function Utility::getLanguageSpecificSolrDynamicFieldNameForSolrDynamicFieldName in Apache Solr Multilingual 8

Maps a solr field name to its language specific equivalent.

For example the dynamic field tm* will become tm;en;* for English. Following this pattern we also have fallbacks automatically:

  • tm;de_AT;*
  • tm;de;*
  • tm*

This concept bases on the fact that "longer patterns will be matched first. If equal size patterns both match,the first appearing in the schema will be used." See https://wiki.apache.org/solr/SchemaXml#Dynamic_fields Note that the real field name for solr is encoded. So the real values for the example above are:

  • tm_3b_de_5f_AT_3b_*
  • tm_3b_de_3b_*
  • tm_*

See Drupal\search_api_solr\Utility\Utility::encodeSolrDynamicFieldName().

Parameters

type $field_name:

type $language_id:

Return value

type

2 calls to Utility::getLanguageSpecificSolrDynamicFieldNameForSolrDynamicFieldName()
SearchApiSolrMultilingualBackend::alterSolrDocuments in src/Plugin/search_api/backend/SearchApiSolrMultilingualBackend.php
Replaces language unspecific fulltext fields by language specific ones.
SearchApiSolrMultilingualBackend::preQuery in src/Plugin/search_api/backend/SearchApiSolrMultilingualBackend.php
Modify the query before it is sent to solr.

File

src/Utility/Utility.php, line 46
Contains \Drupal\apachesolr_multilingual\Utility.

Class

Utility

Namespace

Drupal\apachesolr_multilingual\Utility

Code

public static function getLanguageSpecificSolrDynamicFieldNameForSolrDynamicFieldName($field_name, $language_id) {
  return Utility::_modifySolrDynamicFieldName($field_name, '@^([a-z]+)_@', '$1' . SEARCH_API_SOLR_MULTILINGUAL_LANGUAGE_SEPARATOR . $language_id . SEARCH_API_SOLR_MULTILINGUAL_LANGUAGE_SEPARATOR);
}