You are here

function apachesolr_realtime_entity_delete in Apache Solr Real-Time 7

Implements hook_entity_delete().

1 call to apachesolr_realtime_entity_delete()
apachesolr_realtime_entity_update in ./apachesolr_realtime.module
Implements hook_entity_update().

File

./apachesolr_realtime.module, line 35
Module file for apachesolr_realtime

Code

function apachesolr_realtime_entity_delete($entity, $type) {

  // Obtain the Solr environments.
  $env_ids = _apachesolr_realtime_get_env_ids($type);

  // Extract entity id for Solr.
  $ids = entity_extract_ids($type, $entity);
  $id = $ids[0];
  foreach ($env_ids as $env_id) {

    // Delete the entity from the Solr index.
    apachesolr_remove_entity($env_id, $type, $id);

    // Commit the changes immediately.
    apachesolr_realtime_commit($env_id);
  }
}