public static function Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName()
- 4.x src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName()
Extracts the language code from a language-specific dynamic Solr field.
Parameters
string $field_name: The language-specific dynamic Solr field name.
Return value
mixed The Drupal language code as string or boolean FALSE if no language code could be extracted.
2 calls to Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName()
- AbstractSearchApiSolrMultilingualBackend::alterSolrResponseBody in src/
Plugin/ search_api/ backend/ AbstractSearchApiSolrMultilingualBackend.php - @inheritdoc
- UtilitiesTest::doDynamicFieldNameConversions in tests/
src/ Kernel/ UtilitiesTest.php - Tests all conversion and extraction functions.
File
- src/
Utility/ Utility.php, line 411
Class
- Utility
- Provides various helper functions for Solr backends.
Namespace
Drupal\search_api_solr\UtilityCode
public static function getLanguageIdFromLanguageSpecificSolrDynamicFieldName($field_name) {
$decoded_field_name = Utility::decodeSolrName($field_name);
if (preg_match('@^[a-z]+' . SEARCH_API_SOLR_LANGUAGE_SEPARATOR . '([^_]+?)_@', $decoded_field_name, $matches)) {
return $matches[1];
}
return FALSE;
}