You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by sh...@apache.org on 2009/03/30 21:19:17 UTC

svn commit: r760113 - in /lucene/solr/trunk/src: solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java test/org/apache/solr/client/solrj/TestBatchUpdate.java

Author: shalin
Date: Mon Mar 30 19:19:17 2009
New Revision: 760113

URL: http://svn.apache.org/viewvc?rev=760113&view=rev
Log:
SOLR-1038 -- Remove the automatic commit from the API

Modified:
    lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java
    lucene/solr/trunk/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java

Modified: lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java?rev=760113&r1=760112&r2=760113&view=diff
==============================================================================
--- lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java (original)
+++ lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.java Mon Mar 30 19:19:17 2009
@@ -600,24 +600,16 @@
   }
 
   /**
-   * Adds the documents supplied by the given iterator. A commit is called after all the documents are added.
-   * If an exception is thrown, commit is not called.
+   * Adds the documents supplied by the given iterator.
    *
    * @param docIterator  the iterator which returns SolrInputDocument instances
-   * @param commitParams additional parameters such as optimize, waitFlush, waitSearcher
    *
    * @return the response from the SolrServer
    */
-  public UpdateResponse addAndCommit(Iterator<SolrInputDocument> docIterator, SolrParams commitParams)
+  public UpdateResponse add(Iterator<SolrInputDocument> docIterator)
           throws SolrServerException, IOException {
     UpdateRequest req = new UpdateRequest();
-    req.setDocIterator(docIterator);
-    if (commitParams instanceof ModifiableSolrParams) {
-      req.setParams((ModifiableSolrParams) commitParams);
-    } else if (commitParams != null) {
-      req.setParams(new ModifiableSolrParams(commitParams));
-    }
-    req.setParam(UpdateParams.COMMIT, "true");
+    req.setDocIterator(docIterator);    
     return req.process(this);
   }
 }

Modified: lucene/solr/trunk/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java?rev=760113&r1=760112&r2=760113&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java Mon Mar 30 19:19:17 2009
@@ -58,7 +58,7 @@
   private void doIt(CommonsHttpSolrServer commonsHttpSolrServer) throws SolrServerException, IOException {
     final int[] counter = new int[1];
     counter[0] = 0;
-    commonsHttpSolrServer.addAndCommit(new Iterator<SolrInputDocument>() {
+    commonsHttpSolrServer.add(new Iterator<SolrInputDocument>() {
 
       public boolean hasNext() {
         return counter[0] < numdocs;
@@ -75,16 +75,14 @@
         //do nothing
 
       }
-    }, null);
+    });
+    commonsHttpSolrServer.commit();
     SolrQuery query = new SolrQuery("*:*");
     QueryResponse response = commonsHttpSolrServer.query(query);
     assertEquals(0, response.getStatus());
     assertEquals(numdocs, response.getResults().getNumFound());
   }
 
-
-
-
   @Override public void setUp() throws Exception
   {
     super.setUp();
@@ -102,7 +100,6 @@
     jetty.stop();  // stop the server
   }
 
-
   @Override
   protected SolrServer getSolrServer()
   {