Skip to content

Apache Lucene open-source search software

SOLR-1566 -- calling commit after adding document to make sure that it is actually commited before the other.

Ryan McKinleyb1572f8f3e8a
diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
index 8b7b8c09f76..6dd0ad211a1 100644
--- a/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
+++ b/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
@@ -394,14 +394,13 @@ abstract public class SolrExampleTests extends SolrJettyTestBase
doc.addField( "name", "doc1", 1.0f );
doc.addField( "price", 11 );
server.add( doc );
+ server.commit(); // make sure this gets in first
doc = new SolrInputDocument();
doc.addField( "id", "222", 1.0f );
doc.addField( "name", "doc2", 1.0f );
doc.addField( "price", 22 );
server.add( doc );
-
- // Add the documents
server.commit();
SolrQuery query = new SolrQuery();
@@ -422,7 +421,7 @@ abstract public class SolrExampleTests extends SolrJettyTestBase
// check that the docid is one bigger
int id1 = (Integer)out1.getFieldValue( "_docid_" );
int id2 = (Integer)out2.getFieldValue( "_docid_" );
- assertEquals( "should be one bigger ["+id1+","+id2+"]", id1, id2-1 );
+ assertTrue( "should be bigger ["+id1+","+id2+"]", id2 > id1 );
// The score from explain should be the same as the score
NamedList explain = (NamedList)out1.getFieldValue( "_explain_" );