? 267833_apachesolr_failure_fallback.patch
? apachesolr_failure_default.patch
? failure_fallback.patch
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.29
diff -u -p -r1.1.2.29 apachesolr.module
--- apachesolr.module	10 Sep 2008 08:34:10 -0000	1.1.2.29
+++ apachesolr.module	17 Sep 2008 03:46:16 -0000
@@ -62,6 +62,13 @@ function apachesolr_settings() {
     '#options' => $options,
     '#description' => t('The number of results that will be shown per page.'),
     );
+   $form['apachesolr_failure'] = array(
+     '#type' => 'select',
+     '#title' => t('On failure'),
+     '#options' => array('show_error'=>t('Show Error'), 'show_drupal_results'=>t('Show Drupal Results'), 'show_no_results'=>t('Show No Results')),
+     '#default_value' => variable_get('apachesolr_failure', 'show_error'),
+     '#description' => t('What to display if Apache Solr search is not available.'),
+     );
   return system_settings_form($form);
 }
 
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.15
diff -u -p -r1.1.2.15 apachesolr_search.module
--- apachesolr_search.module	4 Sep 2008 22:11:03 -0000	1.1.2.15
+++ apachesolr_search.module	17 Sep 2008 03:46:16 -0000
@@ -119,9 +119,27 @@ function apachesolr_search_search($op = 
 
       } // try
       catch (Exception $e) {
+        apachesolr_failure($query->get_query());
         watchdog('Apache Solr', $e->getMessage(), WATCHDOG_ERROR);
       }
       break;
 
   } // switch
 }
+
+function apachesolr_failure($querystring) {
+  
+  $fail_rule = variable_get('apachesolr_failure', 'show_error');
+  
+  switch ($fail_rule) {
+    case 'show_error':
+      drupal_set_message('The Apache Solr search engine is not available.  Please contact your site administrator.', 'error');
+      break;
+    case 'show_drupal_results':
+      drupal_goto(drupal_urlencode("search/node/". $querystring));
+      break;
+    case 'show_no_results':
+      return;
+      break;
+  }
+}
\ No newline at end of file
