You are here

function apachesolr_failure in Apache Solr Search 5

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

Determines ApacheSolr'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.

2 calls to apachesolr_failure()
apachesolr_multisitesearch_search in contrib/apachesolr_multisitesearch/apachesolr_multisitesearch.module
Implementation of hook_search().
apachesolr_search_search in ./apachesolr_search.module
Implementation of hook_search().
1 string reference to 'apachesolr_failure'
apachesolr_settings in ./apachesolr.module

File

./apachesolr.module, line 128
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;
  }
}