You are here

function apachesolr_multisitesearch_delete_indexes in Apache Solr Multisite Search 6

Same name and namespace in other branches
  1. 6.3 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_enabled_facets_form 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 244
Provides a multi-site search admin pages and functionality

Code

function apachesolr_multisitesearch_delete_indexes($form, &$form_state) {

  // Instantiate a new Solr object.
  $solr = apachesolr_get_solr();
  foreach ($form_state['values']['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) {

        // Rebuild our node-tracking table.
        apachesolr_rebuild_index_table();
        apachesolr_index_updated(time());
      }
    }
  }
  $solr
    ->commit();
  apachesolr_multisitesearch_get_metadata();
}