Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.99
diff -u -p -r1.1.2.12.2.99 apachesolr.module
--- apachesolr.module	28 Jan 2009 13:49:46 -0000	1.1.2.12.2.99
+++ apachesolr.module	2 Feb 2009 02:42:48 -0000
@@ -394,6 +394,10 @@ function apachesolr_node_to_document($ni
     foreach (module_implements('apachesolr_update_index') as $module) {
       $function = $module .'_apachesolr_update_index';
       $function($document, $node);
+      // Break if the hook implementation decided to not index this document.
+      if (empty($document)) {
+        break;
+      }
     }
   }
   return $document;
Index: apachesolr_search.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.admin.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 apachesolr_search.admin.inc
--- apachesolr_search.admin.inc	27 Jan 2009 20:12:51 -0000	1.1.2.10
+++ apachesolr_search.admin.inc	2 Feb 2009 02:42:48 -0000
@@ -22,7 +22,6 @@ function apachesolr_search_settings_page
     drupal_set_message($e->getMessage(), "warning");
     $output .= t('Cannot get information about the fields in the index at this time.');
   }
-
   return $output;
 }
 
@@ -33,7 +32,7 @@ function apachesolr_search_bias_form($fo
 
   $date_settings = variable_get('apachesolr_search_date_boost', '4:200.0');
   $comment_settings = variable_get('apachesolr_search_comment_boost', '4:200.0');
-  
+
   $options = array(
     '10:2000.0' => '10',
     '8:1000.0' => '9',
@@ -134,3 +133,78 @@ function apachesolr_search_settings_form
   return system_settings_form($form);
 }
 
+/**
+ * Form builder function to set query type weights.
+ */
+function apachesolr_search_type_boost_form($form_state) {
+  $form = array();
+
+  $form['apachesolr_search_type_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Type weighting and exclusion'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+  $form['apachesolr_search_type_settings']['apachesolr_search_type_boosts'] = array(
+    '#type' => 'item',
+    '#description' => t("Specify here which node types should get a higher relevancy score in searches. Any value except 'Normal' will increase the score of the given type in search results."),
+    '#tree' => TRUE,
+  );
+
+  $weights = drupal_map_assoc(array('21.0', '13.0', '8.0', '5.0', '3.0', '2.0', '1.0', '0.8', '0.5', '0.3', '0.2', '0.1'));
+  $weights['0'] = t('Normal');
+
+
+  // Get the current boost values.
+  $type_boosts = variable_get('apachesolr_search_type_boosts', array());
+  $names = node_get_types('names');
+
+  foreach ($names as $type => $name) {
+    $form['apachesolr_search_type_settings']['apachesolr_search_type_boosts'][$type] = array(
+      '#type' => 'select',
+      '#title' => t('Weight for %type', array('%type' => $name)),
+      '#options' => $weights,
+      '#default_value' => isset($type_boosts[$type]) ? $type_boosts[$type] : 0,
+    );
+  }
+
+  $form['apachesolr_search_type_settings']['apachesolr_search_excluded_types'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Types to exclude from the search index'),
+    '#options' => $names,
+    '#default_value' => variable_get('apachesolr_search_excluded_types', array()),
+    '#description' => t("Specify here which node types should be totally excluded from the search index."),
+  );
+
+  $form['#submit'][] = 'apachesolr_search_type_boost_form_submit';
+  return system_settings_form($form);
+}
+
+/**
+ * Submit callback for apachesolr_search_type_boost_form().
+ * 
+ * This is called before system_settings_form_submit().
+ */
+function apachesolr_search_type_boost_form_submit($form_id, &$form_state) {
+  $old_excluded_types = variable_get('apachesolr_search_excluded_types', array());
+  $new_excluded_types = $form_state['values']['apachesolr_search_excluded_types'];
+  // Check whether we are resetting the values.
+  if ($form_state['clicked_button']['#value'] == t('Reset to defaults')) {
+    $new_excluded_types = array();
+  }
+
+  foreach ($new_excluded_types as $type => $excluded) {
+    // Remove newly omitted node types.
+    if (!empty($new_excluded_types[$type]) && empty($old_excluded_types[$type])) {
+      $solr = apachesolr_get_solr();
+      $solr->deleteByQuery("type:$type");
+    }
+  }
+
+  foreach ($old_excluded_types as $type => $excluded) {
+    // Set no longer omitted node types for reindexing.
+    if (empty($new_excluded_types[$type]) && !empty($old_excluded_types[$type])) {
+      db_query("UPDATE {apachesolr_search_node} SET changed = %d WHERE nid IN (SELECT nid FROM {node} WHERE type = '%s')", time(), $type);
+    }
+  }
+}
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.63
diff -u -p -r1.1.2.6.2.63 apachesolr_search.module
--- apachesolr_search.module	27 Jan 2009 21:32:34 -0000	1.1.2.6.2.63
+++ apachesolr_search.module	2 Feb 2009 02:42:48 -0000
@@ -40,6 +40,15 @@ function apachesolr_search_menu() {
     'type'             => MENU_LOCAL_TASK,
     'file'             => 'apachesolr_search.admin.inc',
   );
+  $items['admin/settings/apachesolr/node-types'] = array(
+    'title'            => 'Content type settings',
+    'page callback'    => 'drupal_get_form',
+    'page arguments'   => array('apachesolr_search_type_boost_form'),
+    'access arguments' => array('administer site configuration'),
+    'weight'           => 1,
+    'type'             => MENU_LOCAL_TASK,
+    'file'             => 'apachesolr_search.admin.inc',
+  );
 
   return $items;
 }
@@ -54,6 +63,17 @@ function apachesolr_search_update_index(
 }
 
 /**
+ * Implementations of hook_apachesolr_update_index.
+ */
+function apachesolr_search_apachesolr_update_index(&$document, $node) {
+  // Remove from processing node types we don't want.
+  $excluded_types = variable_get('apachesolr_search_excluded_types', array());
+  if (!empty($excluded_types[$node->type])) {
+    $document = FALSE;
+  }
+}
+
+/**
  * Implementation of hook_search().
  */
 function apachesolr_search_search($op = 'search', $keys = NULL) {
@@ -181,6 +201,15 @@ function apachesolr_search_search($op = 
         if ($comment_boost) {
           $params['bf'][] = "recip(rord(comment_count),$comment_steepness,$total,$total)^$comment_boost";
         }
+
+        // Modify the weight of results according to the node types.
+        $type_boosts = variable_get('apachesolr_search_type_boosts', array());
+        if (!empty($type_boosts)) {
+          foreach ($type_boosts as $type => $boost) {
+            $params['bq'][] = "type:$type^$boost";
+          }
+        }
+
         // This hook allows modules to modify the query and params objects.
         apachesolr_modify_query($query, $params, 'apachesolr_search');
         if (!$query) {
