You are here

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

Same name and namespace in other branches
  1. 8.3 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::decodeSolrName()
  2. 8 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

encodeSolrDynamicFieldName() for details.

7 calls to Utility::decodeSolrName()
SearchApiSolrMultilingualManagedSchemaBackend::createSolrMultilingualFieldType in src/Plugin/search_api/backend/SearchApiSolrMultilingualManagedSchemaBackend.php
Creates and deploys a missing Solr Field Type if the server supports it.
UtilitiesTest::doDynamicFieldNameConversions in tests/src/Kernel/UtilitiesTest.php
Tests all conversion and extraction functions.
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.

... See full list

File

src/Utility/Utility.php, line 294

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);
}