public static function Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName in Search API Solr 8.3
Same name and namespace in other branches
- 8.2 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.
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]+' . SolrBackendInterface::SEARCH_API_SOLR_LANGUAGE_SEPARATOR . '([^_]+?)_@', $decoded_field_name, $matches)) {
return $matches[1];
}
return FALSE;
}