You are here

function apachesolr_index_mark_for_reindex in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.index.inc \apachesolr_index_mark_for_reindex()
  2. 7 apachesolr.index.inc \apachesolr_index_mark_for_reindex()

Mark a certain entity type for a specific environment for reindexing.

Parameters

$env_id:

null $entity_type:

5 calls to apachesolr_index_mark_for_reindex()
apachesolr_drush_solr_mark_for_reindex in drush/apachesolr.drush.inc
Mark all of a specific environment id for reindexing
apachesolr_enable in ./apachesolr.install
Implements hook_enable().
apachesolr_index_action_form_reset_confirm_submit in ./apachesolr.admin.inc
Submit handler for the deletion form.
apachesolr_index_delete_index in ./apachesolr.index.inc
Delete the whole index for an environment.
apachesolr_search_search_reset in ./apachesolr_search.module
Implements hook_search_reset().

File

./apachesolr.index.inc, line 683
Functions related to Apache Solr indexing operations.

Code

function apachesolr_index_mark_for_reindex($env_id, $entity_type = NULL) {
  foreach (entity_get_info() as $type => $entity_info) {
    if ($type == $entity_type || $entity_type == NULL) {
      if (isset($entity_info['apachesolr']) && $entity_info['apachesolr']['indexable']) {
        $reindex_callback = apachesolr_entity_get_callback($type, 'reindex callback');
        if (!empty($reindex_callback)) {
          call_user_func($reindex_callback, $env_id);
        }
      }
    }
  }
  apachesolr_clear_last_index_position($env_id, $entity_type);
  cache_clear_all('*', 'cache_apachesolr', TRUE);
}