function apachesolr_remove_entity in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 apachesolr.module \apachesolr_remove_entity()
- 7 apachesolr.module \apachesolr_remove_entity()
2 calls to apachesolr_remove_entity()
- apachesolr_entity_delete in ./
apachesolr.module - Implements hook_entity_delete().
- apachesolr_index_entities_document in ./
apachesolr.index.inc - Convert a certain entity from the apachesolr index table to a set of documents. 1 entity can be converted in multiple documents if the apachesolr_index_entity_to_documents decides to do so.
File
- ./
apachesolr.module, line 2032 - Integration with the Apache Solr search application.
Code
function apachesolr_remove_entity($env_id, $entity_type, $entity_id) {
module_load_include('inc', 'apachesolr', 'apachesolr.index');
$indexer_table = apachesolr_get_indexer_table($entity_type);
if (apachesolr_index_delete_entity_from_index($env_id, $entity_type, $entity_id)) {
// There was no exception, so delete from the table.
db_delete($indexer_table)
->condition('entity_type', $entity_type)
->condition('entity_id', $entity_id)
->execute();
}
else {
// Set status 0 so we try to delete from the index again in the future.
db_update($indexer_table)
->condition('entity_id', $entity_id)
->fields(array(
'changed' => REQUEST_TIME,
'status' => 0,
))
->execute();
}
}