Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1077
diff -u -p -r1.1077 node.module
--- modules/node/node.module	2 Jul 2009 04:27:23 -0000	1.1077
+++ modules/node/node.module	2 Jul 2009 11:37:06 -0000
@@ -2028,7 +2028,7 @@ function node_update_index() {
   $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);
 
   foreach ($result as $node) {
-    _node_index_node($node);
+    node_index_node($node);
   }
 }
 
@@ -2038,7 +2038,7 @@ function node_update_index() {
  * @param $node
  *   The node to index.
  */
-function _node_index_node($node) {
+function node_index_node($node) {
   $node = node_load($node->nid);
 
   // Save the changed time of the most recent indexed node, for the search
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.8
diff -u -p -r1.8 search.admin.inc
--- modules/search/search.admin.inc	11 Jan 2009 21:19:18 -0000	1.8
+++ modules/search/search.admin.inc	2 Jul 2009 11:37:07 -0000
@@ -69,6 +69,12 @@ function search_admin_settings() {
     '#type' => 'fieldset',
     '#title' => t('Indexing settings')
   );
+  $form['indexing_settings']['search_index_content_insert'] = array(
+    '#title' => t('Index content when created'),
+    '#type' => 'checkbox',
+    '#default_value' => variable_get('search_index_content_insert', TRUE),
+    '#description' => t('Search module will index content as soon as it is created instead of waiting for a cron run. Not recommended for high traffic sites.'),
+  );
   $form['indexing_settings']['info'] = array(
     '#markup' => t('<p><em>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</em></p><p><em>The default settings should be appropriate for the majority of sites.</em></p>')
   );
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.300
diff -u -p -r1.300 search.module
--- modules/search/search.module	1 Jul 2009 20:39:20 -0000	1.300
+++ modules/search/search.module	2 Jul 2009 11:37:07 -0000
@@ -653,6 +653,20 @@ function search_node_update_index($node)
 }
 
 /**
+ * Implement hook_node_insert().
+ */
+function search_node_insert($node) {
+  // Index nodes when first created so that the immediately show up in search
+  // results.
+  if (variable_get('search_index_content_insert', TRUE)) {
+    // Register a shutdown function for the search index update to ensure
+    // the node is added to the index. @see search_cron().
+    node_index_node($node);
+    register_shutdown_function('search_update_totals');;
+  }
+}
+
+/**
  * Implement hook_node_update().
  */
 function search_node_update($node) {
