You are here

public static function Utility::createCombinedId in Search API 8

Creates a combined ID from a raw ID and an optional datasource prefix.

This can be used to created an internal item ID from a datasource ID and a datasource-specific raw item ID, or a combined property path from a datasource ID and a property path to identify properties index-wide.

Parameters

string|null $datasource_id: The ID of the datasource to which the item belongs. Or NULL to return the raw ID unchanged (option included for compatibility purposes).

string $raw_id: The datasource-specific raw item ID of the item (or property).

Return value

string The combined ID, with the datasource prefix separated by \Drupal\search_api\IndexInterface::DATASOURCE_ID_SEPARATOR.

32 calls to Utility::createCombinedId()
AddURLKernelTest::testItemFieldExtraction in tests/src/Kernel/Processor/AddURLKernelTest.php
Tests extracting the field for a search item.
AggregatedFieldsTest::testAggregation in tests/src/Unit/Processor/AggregatedFieldsTest.php
Tests aggregated fields of the given type.
BasicTrackerTest::testTracking in tests/src/Kernel/BasicTrackerTest.php
Tests tracking.
DatasourceTaskTest::testItemTranslations in tests/src/Kernel/Datasource/DatasourceTaskTest.php
Tests that datasource config changes are reflected correctly.
EntityStatusTest::testAlterItems in tests/src/Unit/Processor/EntityStatusTest.php
Tests if unpublished/inactive entities are removed from the indexed items.

... See full list

File

src/Utility/Utility.php, line 86

Class

Utility
Contains utility methods for the Search API.

Namespace

Drupal\search_api\Utility

Code

public static function createCombinedId($datasource_id, $raw_id) {
  if (!isset($datasource_id)) {
    return $raw_id;
  }
  return $datasource_id . IndexInterface::DATASOURCE_ID_SEPARATOR . $raw_id;
}