Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1225
diff -u -p -r1.1225 node.module
--- modules/node/node.module	30 Jan 2010 02:52:08 -0000	1.1225
+++ modules/node/node.module	1 Feb 2010 08:23:29 -0000
@@ -2435,7 +2435,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, array(), array('target' => 'slave'));
 
   foreach ($result as $node) {
-    _node_index_node($node);
+    node_index_node($node);
   }
 }
 
@@ -2445,7 +2445,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.14
diff -u -p -r1.14 search.admin.inc
--- modules/search/search.admin.inc	30 Jan 2010 07:59:25 -0000	1.14
+++ modules/search/search.admin.inc	1 Feb 2010 08:23:29 -0000
@@ -92,6 +92,12 @@ function search_admin_settings($form) {
     '#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.336
diff -u -p -r1.336 search.module
--- modules/search/search.module	30 Jan 2010 07:59:25 -0000	1.336
+++ modules/search/search.module	1 Feb 2010 08:23:30 -0000
@@ -766,6 +766,22 @@ function search_node_update($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) && in_array('node', variable_get('search_active_modules', array('node', 'user')))) {
+    // Register a shutdown function for the search index update to ensure
+    // the node is added to the index, after it has been fully saved (after
+    // all the hook_node_insert() implementation have run).
+    // @see search_cron().
+    register_shutdown_function('node_index_node', $node);
+    register_shutdown_function('search_update_totals');
+  }
+}
+
+/**
  * Implements hook_comment_insert().
  */
 function search_comment_insert($comment) {
