You are here

function apachesolr_delete_node_from_index in Apache Solr Search 6

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_delete_node_from_index()
  2. 6.2 apachesolr.module \apachesolr_delete_node_from_index()
2 calls to apachesolr_delete_node_from_index()
_apachesolr_nodeapi_delete in ./apachesolr.module
Helper function for hook_nodeapi().
_apachesolr_nodeapi_update in ./apachesolr.module
Helper function for hook_nodeapi().

File

./apachesolr.module, line 494
Integration with the Apache Solr search application.

Code

function apachesolr_delete_node_from_index($node) {
  static $failed = FALSE;
  if ($failed) {
    return FALSE;
  }
  try {
    $solr = apachesolr_get_solr();
    $solr
      ->deleteById(apachesolr_document_id($node->nid));
    apachesolr_index_updated(time());
    return TRUE;
  } catch (Exception $e) {
    watchdog('Apache Solr', nl2br(check_plain($e
      ->getMessage())), NULL, WATCHDOG_ERROR);

    // Don't keep trying queries if they are failing.
    $failed = TRUE;
    return FALSE;
  }
}