You are here

public function SearchApiCombinedEntityDataSourceController::trackItemInsert in Search API 7

Starts tracking the index status for the given items on the given indexes.

Parameters

array $item_ids: The IDs of new items to track.

SearchApiIndex[] $indexes: The indexes for which items should be tracked.

bool $skip_type_check: (optional) If TRUE, don't check whether the type matches the index's datasource configuration. Internal use only.

Return value

SearchApiIndex[]|null All indexes for which any items were added; or NULL if items were added for all of them.

Throws

SearchApiDataSourceException If any error state was encountered.

Overrides SearchApiAbstractDataSourceController::trackItemInsert

1 call to SearchApiCombinedEntityDataSourceController::trackItemInsert()
SearchApiCombinedEntityDataSourceController::startTracking in includes/datasource_multiple.inc
Initializes tracking of the index status of items for the given indexes.

File

includes/datasource_multiple.inc, line 225
Contains SearchApiCombinedEntityDataSourceController.

Class

SearchApiCombinedEntityDataSourceController
Provides a datasource for indexing multiple types of entities.

Code

public function trackItemInsert(array $item_ids, array $indexes, $skip_type_check = FALSE) {
  $ret = array();
  foreach ($indexes as $index_id => $index) {
    $ids = drupal_map_assoc($item_ids);
    if (!$skip_type_check) {
      $types = $this
        ->getEntityTypes($index);
      foreach ($ids as $id) {
        list($type) = explode('/', $id);
        if (!isset($types[$type])) {
          unset($ids[$id]);
        }
      }
    }
    if ($ids) {
      parent::trackItemInsert($ids, array(
        $index,
      ));
      $ret[$index_id] = $index;
    }
  }
  return $ret;
}