--- apachesolr/apachesolr_search.module	Wed Aug 11 23:43:16 2010
+++ apachesolr/apachesolr_search.module	Mon Oct 04 15:15:32 2010
@@ -69,6 +69,9 @@
       $menu['search/node/%menu_tail']['type'] = MENU_CALLBACK;
       unset($menu['search/node/%menu_tail']['title callback'], $menu['search/node/%menu_tail']['title arguments']);
       $menu['search/node/%menu_tail']['title'] = 'Search';
+		if (variable_get('apachesolr_search_make_default_replace_core', 0)) {
+			$menu['search/node/%menu_tail']['page arguments'] = array('apachesolr_search');
+		}	
     }
     if (isset($menu['search/apachesolr_search/%menu_tail'])) {
       // Alter the solr search tab
@@ -1010,11 +1013,22 @@
     '#default_value' => variable_get('apachesolr_search_make_default', 0),
     '#options' => array(0 => t('Disabled'), 1 => t('Enabled')),
     '#description' => t('Hides core node search, and makes the search block submit to Apache Solr Search'),
+  );  
+  $form['advanced']['apachesolr_search_make_default_replace_core'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Replace core search'),
+    '#default_value' => variable_get('apachesolr_search_make_default_replace_core', 0),
+    '#options' => array(0 => t('make core search reachable'), 1 => t('make core search not reachable')),
+    '#description' => t('if Apache Solr Search has been set as default search, checking this option will replace the core search ( otherwise it will be hidden but reachable )'),
   );
   $form['advanced']['apachesolr_search_default_previous'] = array(
     '#type' => 'value',
     '#value' => variable_get('apachesolr_search_make_default', 0),
   );
+  $form['advanced']['apachesolr_search_replace_previous'] = array(
+    '#type' => 'value',
+    '#value' => variable_get('apachesolr_search_make_default_replace_core', 0),
+  );
   $form['advanced']['apachesolr_search_taxonomy_links'] = array(
     '#type' => 'radios',
     '#title' => t('Use Apache Solr for taxonomy links'),
@@ -1050,7 +1064,8 @@
 function apachesolr_search_make_default_submit($form, &$form_state) {
   // We use variable_get() instead of the form values so as to also handle reset to defaults.
   if ($form_state['values']['apachesolr_search_default_previous'] != variable_get('apachesolr_search_make_default', 0) ||
-      $form_state['values']['apachesolr_search_taxonomy_previous'] != variable_get('apachesolr_search_taxonomy_links', 0)) {
+      $form_state['values']['apachesolr_search_taxonomy_previous'] != variable_get('apachesolr_search_taxonomy_links', 0)||
+      $form_state['values']['apachesolr_search_replace_previous'] != variable_get('apachesolr_search_make_default_replace_core', 0)) {
     // Take account of path changes
     menu_rebuild();
   }
--- apachesolr/apachesolr.admin.inc	Mon Jun 28 03:59:56 2010
+++ apachesolr/apachesolr.admin.inc	Mon Oct 04 13:30:51 2010
@@ -108,6 +108,9 @@
     if (!ctype_digit($port) || $port < 1 || $port > 65535) {
       form_set_error('apachesolr_port', t('The port has to be an integer between 1 and 65535.'));
     }
+	if($form_state['values']['apachesolr_search_make_default_replace_core'] && $form_state['values']['apachesolr_failure']=='show_drupal_results') {
+		form_set_error('apachesolr_failure',t('Drupal core search cannot be replaced if behaviour in "On failure" option is set to %show_core_message',array('%show_core_message'=>t('Show core Drupal results'))));
+	}
   }
 }
 
