You are here

interface TrackerInterface in Search API 8

Defines an interface for index tracker plugins.

The tracker of an index is responsible for keeping track of the items indexed in the index, which have changed since they were last indexed, etc.

The tracker is required to ignore calls to tracking methods for item IDs that won't have any effect – that is, inserting items which are already known, or marking items as indexed, updated or deleted that are not.

Hierarchy

Expanded class hierarchy of TrackerInterface

All classes that implement TrackerInterface

See also

\Drupal\search_api\Annotation\SearchApiTracker

\Drupal\search_api\Tracker\TrackerPluginManager

\Drupal\search_api\Tracker\TrackerPluginBase

Plugin API

3 files declare their use of TrackerInterface
Index.php in src/Entity/Index.php
IndexInterface.php in src/IndexInterface.php
UnsavedIndexConfiguration.php in src/UnsavedIndexConfiguration.php

File

src/Tracker/TrackerInterface.php, line 22

Namespace

Drupal\search_api\Tracker
View source
interface TrackerInterface extends IndexPluginInterface {

  /**
   * Inserts new items into the tracking system for this index.
   *
   * @param string[] $ids
   *   The item IDs of the new search items.
   */
  public function trackItemsInserted(array $ids);

  /**
   * Marks the given items as updated for this index.
   *
   * @param string[] $ids
   *   The item IDs of the updated items.
   */
  public function trackItemsUpdated(array $ids);

  /**
   * Marks all items as updated, or only those of a specific datasource.
   *
   * @param string|null $datasource_id
   *   (optional) If given, only items of that datasource are marked as updated.
   */
  public function trackAllItemsUpdated($datasource_id = NULL);

  /**
   * Marks items as indexed for this index.
   *
   * @param string[] $ids
   *   An array of item IDs.
   */
  public function trackItemsIndexed(array $ids);

  /**
   * Removes items from the tracking system for this index.
   *
   * @param string[]|null $ids
   *   (optional) The item IDs of the deleted items; or NULL to remove all
   *   items.
   */
  public function trackItemsDeleted(array $ids = NULL);

  /**
   * Removes all items from the tracker, or only those of a specific datasource.
   *
   * @param string|null $datasource_id
   *   (optional) If given, only items of that datasource are removed.
   */
  public function trackAllItemsDeleted($datasource_id = NULL);

  /**
   * Retrieves a list of item IDs that need to be indexed.
   *
   * @param int $limit
   *   (optional) The maximum number of items to return. Or a negative value to
   *   return all remaining items.
   * @param string|null $datasource_id
   *   (optional) If specified, only items of the datasource with that ID are
   *   retrieved.
   *
   * @return string[]
   *   The IDs of items that still need to be indexed.
   */
  public function getRemainingItems($limit = -1, $datasource_id = NULL);

  /**
   * Retrieves the total number of items that are being tracked for this index.
   *
   * @param string|null $datasource_id
   *   (optional) The datasource to filter the total number of items by.
   *
   * @return int
   *   The total number of items that are tracked for this index, or for the
   *   given datasource on this index.
   */
  public function getTotalItemsCount($datasource_id = NULL);

  /**
   * Retrieves the number of indexed items for this index.
   *
   * @param string|null $datasource_id
   *   (optional) The datasource to filter the total number of indexed items by.
   *
   * @return int
   *   The number of items that have been indexed in their latest state for this
   *   index, or for the given datasource on this index.
   */
  public function getIndexedItemsCount($datasource_id = NULL);

  /**
   * Retrieves the total number of pending items for this index.
   *
   * @param string|null $datasource_id
   *   (optional) The datasource to filter the total number of pending items by.
   *
   * @return int
   *   The total number of items that still need to be indexed for this index,
   *   or for the given datasource on this index.
   */
  public function getRemainingItemsCount($datasource_id = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
ConfigurablePluginInterface::getDescription public function Returns the plugin's description. 1
ConfigurablePluginInterface::label public function Returns the label for use on the administration pages. 1
ConfigurablePluginInterface::onDependencyRemoval public function Informs the plugin that some of its dependencies are being removed. 1
ContainerFactoryPluginInterface::create public static function Creates an instance of the plugin. 112
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
DerivativeInspectionInterface::getBaseId public function Gets the base_plugin_id of the plugin instance. 1
DerivativeInspectionInterface::getDerivativeId public function Gets the derivative_id of the plugin instance. 1
HideablePluginInterface::isHidden public function Determines whether this plugin should be hidden in the UI. 1
IndexPluginInterface::getIndex public function Retrieves the index this plugin is configured for. 1
IndexPluginInterface::setIndex public function Sets the index this plugin is configured for. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
TrackerInterface::getIndexedItemsCount public function Retrieves the number of indexed items for this index. 2
TrackerInterface::getRemainingItems public function Retrieves a list of item IDs that need to be indexed. 2
TrackerInterface::getRemainingItemsCount public function Retrieves the total number of pending items for this index. 2
TrackerInterface::getTotalItemsCount public function Retrieves the total number of items that are being tracked for this index. 2
TrackerInterface::trackAllItemsDeleted public function Removes all items from the tracker, or only those of a specific datasource. 2
TrackerInterface::trackAllItemsUpdated public function Marks all items as updated, or only those of a specific datasource. 2
TrackerInterface::trackItemsDeleted public function Removes items from the tracking system for this index. 2
TrackerInterface::trackItemsIndexed public function Marks items as indexed for this index. 2
TrackerInterface::trackItemsInserted public function Inserts new items into the tracking system for this index. 2
TrackerInterface::trackItemsUpdated public function Marks the given items as updated for this index. 2