You are here

function apachesolr_attachments_clean_index_table in Apache Solr Attachments 6.3

Same name and namespace in other branches
  1. 7 apachesolr_attachments.index.inc \apachesolr_attachments_clean_index_table()
2 calls to apachesolr_attachments_clean_index_table()
apachesolr_attachments_entity_delete in ./apachesolr_attachments.module
apachesolr_attachments_entity_update in ./apachesolr_attachments.module

File

./apachesolr_attachments.index.inc, line 241
Indexing-related functions.

Code

function apachesolr_attachments_clean_index_table() {
  $indexer_table = apachesolr_get_indexer_table('file');

  // Clean all entries where parent_entity_id is empty
  db_delete($indexer_table)
    ->condition('parent_entity_id', 0)
    ->execute();

  // Clean all entries from entity types that should not be indexed
  foreach (entity_get_info() as $entity_type => $entity_info) {
    if (empty($entity_info['apachesolr']['indexable'])) {
      db_delete($indexer_table)
        ->condition('parent_entity_type', $entity_type)
        ->execute();
    }
  }
}