public static function Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName()
- 8.2 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 428
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;
}