My file attachments are indexed using apachesolr attachments 7.x-1.x-dev. I have a custom module that physically deletes a file using file_delete(), but file still remains in Apachesolr index even after re-indexing. The only way to remove from search results is to delete the index then reindex.
I tried this to no avail:
// Remove file from apachesolr index $env_id = apachesolr_default_environment(); $entity_type = 'file'; $entity_id = apachesolr_document_id($file->fid, 'file'); apachesolr_remove_entity($env_id, $entity_type, $entity_id); drupal_set_message('Deleting '.$file->uri.' from private attachments.'); file_delete($file);
The file is physically removed, but not removed from index.
Any suggestions on how to remove file from apachesolr attachments index/search results after it is deleted?