You are here

function apachesolr_multisitesearch_exclude_indexes in Apache Solr Multisite Search 7

Same name and namespace in other branches
  1. 6.3 apachesolr_multisitesearch.admin.inc \apachesolr_multisitesearch_exclude_indexes()

Submit handler for the "Exclude content types" button.

1 string reference to 'apachesolr_multisitesearch_exclude_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 86
Administrative pages for the Apache Solr Multi-Site Search framework.

Code

function apachesolr_multisitesearch_exclude_indexes($form, &$form_state) {
  $fv = $form_state['values'];
  if ($fv['op'] == t('Clear all exclusions')) {
    variable_del('apachesolr_multisitesearch_query_exclusions');
    drupal_set_message('All content exclusions have been cleared.');
  }
  elseif (isset($fv['query_exclusions']['exclusion_options']) && !empty($fv['query_exclusions']['exclusion_options'])) {

    // Set the variable to store the query filter keys and create a string
    // to display the excluded content.
    variable_set('apachesolr_multisitesearch_query_exclusions', $fv['query_exclusions']['exclusion_options']);
    $query_exclusion_options = apachesolr_multisitesearch_query_bundles();

    // Match the exclusion options' keys to their values and slap them together.
    $matches = array_intersect_key($query_exclusion_options, $fv['query_exclusions']['exclusion_options']);
    $output = implode($matches, ", ");
    drupal_set_message(t('The following content types will be excluded from search: <em>@output</em>', array(
      '@output' => $output,
    )));
  }
  else {

    // If nothing is selected to be excluded, delete the variable, and
    // let the user know.
    variable_del('apachesolr_multisitesearch_query_exclusions');
    drupal_set_message(t('<strong>No content</strong> will be excluded from search.'));
  }
}