You are here

function _asa_remove_attachments_from_index in Apache Solr Attachments 5

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

2 calls to _asa_remove_attachments_from_index()
apachesolr_attachments_nodeapi in ./apachesolr_attachments.module
Implementation of hook_nodeapi().
apachesolr_attachments_update_index in ./apachesolr_attachments.module
Hook is called by search.module to add things to the search index. In our case we will search content types and add any CCK type that is a file type that we know how to parse and any uploaded file attachments.

File

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

Code

function _asa_remove_attachments_from_index($nid) {
  try {
    $solr = _get_solr_instance();
    $solr
      ->deleteByQuery("nid:{$nid} AND bsfield_isfile:true");
    $solr
      ->commit();
  } catch (Exception $e) {
    watchdog(SOLR_ATTACHMENT_WD, $e
      ->getMessage(), WATCHDOG_ERROR);
  }
}