You are here

public static function Utility::decodeSolrName in Search API Solr 8.3

Same name and namespace in other branches
  1. 8 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::decodeSolrName()
  2. 8.2 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::decodeSolrName()
  3. 4.x src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::decodeSolrName()

Decodes solr field names.

This function therefore decodes all forbidden characters from their hexadecimal equivalent encapsulated by a leading sequence of '_X' and a termination character '_'. Example: "tm_entity_X3a_node_X2f_body" becomes "tm_entity:node/body".

Parameters

string $field_name: Encoded field name.

Return value

string The decoded field name

See also

\Drupal\search_api_solr\Utility\Utility::modifySolrDynamicFieldName()

6 calls to Utility::decodeSolrName()
SearchApiSolrBackend::formatSolrFieldNames in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Returns a language-specific mapping from Drupal to Solr field names.
UtilitiesTest::testFieldNameEncoder in tests/src/Kernel/UtilitiesTest.php
Tests encoding and decoding of Solr field names.
UtilitiesTest::testLanguageSpecificFieldTypeNames in tests/src/Kernel/UtilitiesTest.php
Tests language-specific Solr field names.
Utility::extractLanguageSpecificSolrDynamicFieldDefinition in src/Utility/Utility.php
Extracts the language-specific definition from a dynamic Solr field.
Utility::getLanguageIdFromLanguageSpecificSolrDynamicFieldName in src/Utility/Utility.php
Extracts the language code from a language-specific dynamic Solr field.

... See full list

File

src/Utility/Utility.php, line 296

Class

Utility
Provides various helper functions for Solr backends.

Namespace

Drupal\search_api_solr\Utility

Code

public static function decodeSolrName($field_name) {
  return preg_replace_callback('/_X([\\dabcdef]+?)_/', function ($matches) {
    return hex2bin($matches[1]);
  }, $field_name);
}