You are here

function apachesolr_attachments_remove_attachments_from_index in Apache Solr Attachments 6

Same name and namespace in other branches
  1. 6.3 apachesolr_attachments.module \apachesolr_attachments_remove_attachments_from_index()
  2. 6.2 apachesolr_attachments.module \apachesolr_attachments_remove_attachments_from_index()
  3. 7 apachesolr_attachments.module \apachesolr_attachments_remove_attachments_from_index()

For a particular node id, remove all file attachments from the solr index.

1 call to apachesolr_attachments_remove_attachments_from_index()
apachesolr_attachments_nodeapi in ./apachesolr_attachments.module
Implementation of hook_nodeapi().

File

./apachesolr_attachments.module, line 208
Provides a file attachment search implementation for use with the Apache Solr module

Code

function apachesolr_attachments_remove_attachments_from_index($nid) {
  try {
    $solr = apachesolr_get_solr();
    $solr
      ->deleteByQuery("nid:{$nid} AND entity:file AND hash:" . apachesolr_site_hash());
    $solr
      ->commit();
  } catch (Exception $e) {

    // Shortened project name because the watchdog limits type to 16 characters.
    watchdog('ApacheSolrAttach', nl2br(check_plain($e
      ->getMessage())), NULL, WATCHDOG_ERROR);
  }
}