Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.256
diff -u -u -p -r1.256 search.module
--- modules/search/search.module	6 May 2008 12:18:50 -0000	1.256
+++ modules/search/search.module	13 May 2008 15:13:59 -0000
@@ -573,10 +571,11 @@ function search_index($sid, $type, $text
   foreach ($results[0] as $word => $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);
+    db_query("INSERT INTO {search_index} (word, sid, type, score) VALUES ('%s', %d, '%s', %f)", $word, $sid, $type, $score);
     if (!db_affected_rows()) {
-      db_query("INSERT INTO {search_index} (word, sid, type, score) VALUES ('%s', %d, '%s', %f)", $word, $sid, $type, $score);
+      db_query("UPDATE {search_index} SET score = score + %f WHERE word = '%s' AND sid = '%d' AND type = '%s'", $score, $word, $sid, $type);
     }
     search_dirty($word);
   }
   unset($results[0]);
