Index: solrconfig.xml
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Attic/solrconfig.xml,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 solrconfig.xml
--- solrconfig.xml	8 Jan 2009 15:08:12 -0000	1.1.2.11
+++ solrconfig.xml	8 Jan 2009 20:37:34 -0000
@@ -178,11 +178,12 @@
     <!-- Perform a <commit/> automatically under certain conditions:
          maxDocs - number of updates since last commit is greater than this
          maxTime - oldest uncommited update (in ms) is this long ago
+    -->
     <autoCommit> 
-      <maxDocs>10000</maxDocs>
-      <maxTime>1000</maxTime> 
+      <maxDocs>500</maxDocs>
+      <maxTime>240000</maxTime> 
     </autoCommit>
-    -->
+
 
     <!-- The RunExecutableListener executes an external command.
          exe - the name of the executable to run
Index: apachesolr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v
retrieving revision 1.1.2.12.2.83
diff -u -p -r1.1.2.12.2.83 apachesolr.module
--- apachesolr.module	31 Dec 2008 19:14:40 -0000	1.1.2.12.2.83
+++ apachesolr.module	8 Jan 2009 20:37:34 -0000
@@ -233,7 +233,6 @@ function apachesolr_delete_index_form_su
       // content:  $query = 'hash:' . apachesolr_site_hash()
       drupal_alter('apachesolr_delete_index', $query);
       $solr->deleteByQuery($query);
-      $solr->commit();
       apachesolr_clear_last_index();
       // This form can't be seen by anyone without 'administer site configuration'
       // permission, so no need to check perms before displaying a run-cron link.
@@ -398,8 +397,6 @@ function apachesolr_index_nodes($result,
       foreach ($docs_chunk as $docs) {
         $solr->addDocuments($docs);
       }
-      $solr->commit();
-      $solr->optimize(FALSE, FALSE);
       $last = array('last_change' => $solr_last_change, 'last_nid' => $solr_last_id);
       if ($namespace) {
         $stored = variable_get('apachesolr_index_last', array());
@@ -624,7 +621,6 @@ function apachesolr_delete_node_from_ind
   try {
     $solr = apachesolr_get_solr();
     $solr->deleteById(apachesolr_document_id($node->nid));
-    $solr->commit();
   }
   catch (Exception $e) {
     watchdog('Apache Solr', $e->getMessage(), NULL, WATCHDOG_ERROR);
@@ -638,6 +634,13 @@ function apachesolr_cron() {
   try {
     $solr = apachesolr_get_solr();
     $solr->clearCache();
+    $last = variable_get('apachesolr_search_last_optimize', 0);
+    $time = time();
+    // Make sure to omtimize once per day.
+    if ($time - $last > 60*60*24) {
+      $solr->optimize(FALSE, FALSE);
+      variable_set('apachesolr_search_last_optimize', $time);
+    }
   }
   catch (Exception $e) {
     watchdog('Apache Solr', $e->getMessage(), NULL, WATCHDOG_ERROR);
