You are here

public function SearchApiAbstractDataSourceController::startTracking in Search API 7

Initializes tracking of the index status of items for the given indexes.

All currently known items of this data source's type should be inserted into the tracking table for the given indexes, with status "changed". If items were already present, these should also be set to "changed" and not be inserted again.

Parameters

SearchApiIndex[] $indexes: The SearchApiIndex objects for which item tracking should be initialized.

Throws

SearchApiDataSourceException If any error state was encountered.

Overrides SearchApiDataSourceControllerInterface::startTracking

3 methods override SearchApiAbstractDataSourceController::startTracking()
SearchApiCombinedEntityDataSourceController::startTracking in includes/datasource_multiple.inc
Initializes tracking of the index status of items for the given indexes.
SearchApiEntityDataSourceController::startTracking in includes/datasource_entity.inc
Initializes tracking of the index status of items for the given indexes.
SearchApiExternalDataSourceController::startTracking in includes/datasource_external.inc
Initialize tracking of the index status of items for the given indexes.

File

includes/datasource.inc, line 547
Contains the SearchApiDataSourceControllerInterface as well as a default base class.

Class

SearchApiAbstractDataSourceController
Provides a default base class for datasource controllers.

Code

public function startTracking(array $indexes) {
  if (!$this->table) {
    return;
  }

  // We first clear the tracking table for all indexes, so we can just insert
  // all items again without any key conflicts.
  $this
    ->stopTracking($indexes);

  // Insert all items as new.
  $this
    ->trackItemInsert($this
    ->getAllItemIds(), $indexes);
}