diff -P -r -u -F '^function' search_config_old/search_config.module search_config/search_config.module
--- search_config_old/search_config.module	2007-05-22 03:53:30.000000000 +0200
+++ search_config/search_config.module	2007-09-13 20:53:01.000000000 +0200
@@ -146,7 +146,7 @@ function search_config_search($op) {
     case 'admin':
       $form['search_config'] = array(        
         '#type' => 'fieldset',
-        '#title' => t('Advanced search form configuration'),
+        '#title' => t('Advanced search configuration'),
         '#collapsible' => TRUE,
         '#collapsed' => TRUE,
       );
@@ -188,7 +188,6 @@ function search_config_search($op) {
           '#description' => t('Categories to display')
         );
 
-
         $form['search_config']['category']['search_config_disable_category_all'] = array(
           '#type' => 'checkbox',
           '#title' => t('Disable category search'),
@@ -209,22 +208,96 @@ function search_config_search($op) {
       // Node types 
       $types = node_get_types('names');
       $types = array_merge(array('all' => 'Disable all'), $types);
-
+      
       $form['search_config']['type'] = array(
         '#type' => 'fieldset',
         '#title' => t('Node types'),
         '#collapsible' => TRUE,
         '#collapsed' => TRUE ,
-        '#description' => t('Node types that users shouldn\'t be allowed to search by.')
+        '#validate' => array('search_config_validate' => array())
       );
-      
-      $form['search_config']['type']['search_config_disable_type'] = array(
+
+      $form['search_config']['type']['form'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Search Form'),
+        '#collapsible' => FALSE,
+        '#description' => t('Node types that users shouldn\'t be allowed to search by using the the advanced search form.')
+      );
+      $form['search_config']['type']['form']['search_config_disable_type'] = array(
         '#type' => 'checkboxes',
         '#options' => $types,
         '#default_value' => variable_get('search_config_disable_type', array())
       );
-      
+
+      $form['search_config']['type']['index'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Search Index'),
+        '#collapsible' => FALSE,
+        '#description' => t('Node types that should not be index by the search module. Any node type set to not be indexed will also be removed from the search form. If you select all available node types to not be index then the search module will be rendered unusable as no nodes will be indexed.')
+      );
+      // If all node types are disabled then the search module is useless.
+      unset($types['all']);
+      reset($types);
+      $form['search_config']['type']['index']['search_config_disable_index_type'] = array(
+        '#type' => 'checkboxes',
+        '#options' => $types,
+        '#default_value' => variable_get('search_config_disable_index_type', array())
+      );
+
       return $form;
   }
 }
-?>
+
+function search_config_validate($form_values) {
+  if ($form_values['#post']['form_id'] == 'search_admin_settings' && $form_values['#post']['op'] == 'Save configuration') {
+    $post_values = $form_values['#post'];
+    $node_types = node_get_types('names');
+
+    if (!isset($post_values['search_config_disable_index_type'])) {
+      return;
+    }
+    $index_types = $post_values['search_config_disable_index_type'];
+
+    if (!isset($post_values['search_config_disable_type'])) {
+      $post_values['search_config_disable_type'] = array();
+    }
+    $form_types = $post_values['search_config_disable_type'];
+
+    if (count($index_types) != 0 && count($index_types) == count($node_types)) {
+      form_set_error('search_config_disable_index_type', t('You can not set all node types to be not indexed by the search module.'));
+    }
+
+    if (isset($post_values['search_config_disable_type']['all'])) {
+      return;
+    }
+    
+    $type_diff = array_diff($index_types, $form_types);
+    if (count($type_diff)) {
+      $node_errors = array();
+      foreach ($type_diff as $type) {
+        $node_errors[] = $node_types[$type];
+      }
+      form_set_error('search_config_disable_type', t('Search index node types do not match form node types. Please check the setting for %nodes.', array('%nodes' => implode(', ', $node_errors))));
+    }
+  }
+}
+
+/**
+* Implementation of hook_update_index()
+*/
+function search_config_update_index() {
+  // This hook is only called when the search module is enabled
+  // The function_exists check can be removed, but there is no harm in leaving it in
+  if (function_exists('search_wipe')) {
+    $types = node_get_types('names');
+    $remove = variable_get('search_config_disable_index_type', array());
+    foreach ($remove as $type => $value) {
+      if (isset($types[$type]) && $value === $type) {
+        $result = db_query("SELECT n.nid FROM {node} n INNER JOIN {search_dataset} s ON n.nid=s.sid WHERE n.type = '%s'", $type);
+        while ($data = db_fetch_object($result)) {
+          search_wipe($data->nid, 'node');
+        }
+      }
+    }
+  }
+}
