You are here

function apachesolr_failure in Apache Solr Search 6

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_failure()
  2. 5.2 apachesolr.module \apachesolr_failure()
  3. 5 apachesolr.module \apachesolr_failure()
  4. 6.3 apachesolr.module \apachesolr_failure()
  5. 6.2 apachesolr.module \apachesolr_failure()
  6. 7 apachesolr.module \apachesolr_failure()

Determines Apache Solr's behavior when searching causes an exception (e.g. Solr isn't available.) Depending on the admin settings, possibly redirect to Drupal's core search.

Parameters

$search_name: The name of the search implementation.

$querystring: The search query that was issued at the time of failure.

1 call to apachesolr_failure()
apachesolr_search_search in ./apachesolr_search.module
Implementation of hook_search().
2 string references to 'apachesolr_failure'
apachesolr_settings in ./apachesolr.admin.inc
@file Administrative pages for the Apache Solr framework.
apachesolr_uninstall in ./apachesolr.install
Implementation of hook_uninstall().

File

./apachesolr.module, line 151
Integration with the Apache Solr search application.

Code

function apachesolr_failure($search_name, $querystring) {
  $fail_rule = variable_get('apachesolr_failure', 'show_error');
  switch ($fail_rule) {
    case 'show_error':
      drupal_set_message(t('The Apache Solr search engine is not available. Please contact your site administrator.'), 'error');
      break;
    case 'show_drupal_results':
      drupal_set_message(t("%search_name is not available. Your search is being redirected.", array(
        '%search_name' => $search_name,
      )));
      drupal_goto('search/node/' . drupal_urlencode($querystring));
      break;
    case 'show_no_results':
      return;
  }
}