You are here

function search_api_search_api_index_insert in Search API 7

Same name and namespace in other branches
  1. 8 search_api.module \search_api_search_api_index_insert()

Implements hook_search_api_index_insert().

Adds the index to its server (if any) and starts tracking indexed items (if the index is enabled).

File

./search_api.module, line 651
Provides a flexible framework for implementing search services.

Code

function search_api_search_api_index_insert(SearchApiIndex $index) {

  // Check whether this is actually part of a revert.
  $reverts =& drupal_static('search_api_search_api_index_delete', array());
  if (isset($reverts[$index->machine_name])) {
    $index->original = $reverts[$index->machine_name];
    unset($reverts[$index->machine_name]);
    search_api_search_api_index_update($index);
    unset($index->original);
    return;
  }
  $index
    ->postCreate();
}