You are here

function apachesolr_multisitesearch_delete_indexes in Apache Solr Multisite Search 6.3

Same name and namespace in other branches
  1. 6 apachesolr_multisitesearch.admin.inc \apachesolr_multisitesearch_delete_indexes()
  2. 6.2 apachesolr_multisitesearch.admin.inc \apachesolr_multisitesearch_delete_indexes()
  3. 7 apachesolr_multisitesearch.admin.inc \apachesolr_multisitesearch_delete_indexes()

Submit handler for the "Delete selected indexes" button.

1 string reference to 'apachesolr_multisitesearch_delete_indexes'
apachesolr_multisitesearch_settings in ./apachesolr_multisitesearch.admin.inc
Creates the form that allows the user to select which facets will be enabled.

File

./apachesolr_multisitesearch.admin.inc, line 134
Administrative pages for the Apache Solr Multi-Site Search framework.

Code

function apachesolr_multisitesearch_delete_indexes($form, &$form_state) {
  module_load_include('inc', 'apachesolr_multisitesearch', 'apachesolr_multisitesearch.index');
  $fv = $form_state['values'];

  // Instantiate a new Solr object.
  $solr = apachesolr_get_solr();
  $env_id = apachesolr_default_environment();
  foreach ($fv['admin']['delete']['hashes'] as $hash) {
    if ($hash) {
      $query = "hash:{$hash}";
      $solr
        ->deleteByQuery($query);
      drupal_set_message(t('The index for !hash has been deleted.', array(
        '!hash' => $hash,
      )));
      if (apachesolr_site_hash() == $hash) {

        //Todo : we might want to execute apachesolr_node_check_index_table();
        apachesolr_set_last_index_updated($env_id, time());
      }
    }
  }
  $solr
    ->commit();
  apachesolr_multisitesearch_retrieve_metadata();
}