You are here

function apachesolr_realtime_entity_update in Apache Solr Real-Time 7

Implements hook_entity_update().

File

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

Code

function apachesolr_realtime_entity_update($entity, $type) {
  if ($type == 'node' && $entity->status == TRUE) {

    // Clear the static loading cache.
    entity_get_controller('node')
      ->resetCache(array(
      $entity->nid,
    ));
    apachesolr_realtime_index_now($entity, $type);
  }
  else {
    if ($type == 'node' && $entity->status == FALSE) {

      // Remove the unpublished node from the index.
      apachesolr_realtime_entity_delete($entity, $type);
    }
  }
}