Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.250
diff -u -r1.250 search.module
--- modules/search/search.module	8 Jan 2008 10:35:42 -0000	1.250
+++ modules/search/search.module	7 Feb 2008 12:20:42 -0000
@@ -571,7 +571,12 @@
 
   // Insert results into search index
   foreach ($results[0] as $word => $score) {
-    db_query("INSERT INTO {search_index} (word, sid, type, score) VALUES ('%s', %d, '%s', %f)", $word, $sid, $type, $score);
+    // The database will collate similar words (accented and non-accented forms, etc.),
+    // and the score is additive, so first add and then insert.
+    db_query("UPDATE {search_index} SET score = score + %d WHERE word = '%s' AND sid = '%d' AND type = '%s'", $score, $word, $sid, $type);
+    if (!db_affected_rows()) {
+      db_query("INSERT INTO {search_index} (word, sid, type, score) VALUES ('%s', %d, '%s', %f)", $word, $sid, $type, $score);
+    }
     search_dirty($word);
   }
   unset($results[0]);
