You are here

protected function SearchApiEtDatasourceController::filterTrackableIds in Search API Entity Translation 7.2

Filters the given Item IDs to include only the ones handled by the Index.

Parameters

SearchApiIndex $index: The SearchAPI index to use

array $item_ids: A list of trackable ItemID (in the form "{id}/{language}) to filter

Return value

array The filtered list of trackable ItemID

3 calls to SearchApiEtDatasourceController::filterTrackableIds()
SearchApiEtDatasourceController::getTrackableItemIdsFromMixedSource in includes/SearchApiEtDatasourceController.php
Helper function to return the list of ItemIDs, fiven
SearchApiEtDatasourceController::trackItemChange in includes/SearchApiEtDatasourceController.php
SearchApiEtDatasourceController::trackItemInsert in includes/SearchApiEtDatasourceController.php
Starts tracking the index status for the given items on the given indexes.

File

includes/SearchApiEtDatasourceController.php, line 480
Contains the SearchApiEtDatasourceController class.

Class

SearchApiEtDatasourceController
Provides multilingual versions of all entity types.

Code

protected function filterTrackableIds(SearchApiIndex $index, $item_ids) {
  if (empty($item_ids)) {
    return array();
  }

  // Group the given ItemIds by their EntityId.
  $grouped_item_ids = SearchApiEtHelper::getGroupedItemsIdsByEntity($item_ids);
  if (empty($grouped_item_ids)) {
    return array();
  }

  // Generate the list of candidate ItemIDs from the current EntityIDs
  $trackable_item_ids = $this
    ->getTrackableItemIds($index, array_keys($grouped_item_ids));

  // The $trackable_item_ids will contain all ItemIDs that should be indexed.
  // Additional translations, other than the one provided in $item_ids, will
  // be taken into account, to cover the case when a non-translatable field is
  // changed on one translation and such change must be reflected to all other
  // indexed translations.
  return $trackable_item_ids;
}