You are here

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

1 call to Utility::getLangaugeIdFromLanguageSpecificSolrDynamicFieldName()
SearchApiSolrMultilingualBackend::extractResults in src/Plugin/search_api/backend/SearchApiSolrMultilingualBackend.php
@inheritdoc

File

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

Class

Utility

Namespace

Drupal\apachesolr_multilingual\Utility

Code

public static function getLangaugeIdFromLanguageSpecificSolrDynamicFieldName($field_name) {
  $encoded = strpos($field_name, SearchApiSolrUtility::encodeSolrDynamicFieldName(SEARCH_API_SOLR_MULTILINGUAL_LANGUAGE_SEPARATOR));
  if ($encoded) {
    $field_name = SearchApiSolrUtility::decodeSolrDynamicFieldName($field_name);
  }
  if (preg_match('@' . SEARCH_API_SOLR_MULTILINGUAL_LANGUAGE_SEPARATOR . '(.+?)' . SEARCH_API_SOLR_MULTILINGUAL_LANGUAGE_SEPARATOR . '@', $field_name, $matches)) {
    return $matches[1];
  }
  return FALSE;
}