Index: lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.java =================================================================== --- lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.java (revision 980434) +++ lucene/src/test/org/apache/lucene/search/function/FunctionTestSetup.java (working copy) @@ -22,8 +22,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Fieldable; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.store.Directory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.util.LuceneTestCaseJ4; @@ -95,7 +94,7 @@ // prepare a small index with just a few documents. dir = new RAMDirectory(); anlzr = new MockAnalyzer(); - IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, anlzr)); + RandomIndexWriter iw = new RandomIndexWriter(newRandom(), dir, anlzr); // add docs not exactly in natural ID order, to verify we do check the order of docs by scores int remaining = N_DOCS; boolean done[] = new boolean[N_DOCS]; @@ -107,15 +106,15 @@ addDoc(iw, i); done[i] = true; i = (i + 4) % N_DOCS; - if (doMultiSegment && remaining % 3 == 0) { - iw.commit(); - } remaining --; } + if (!doMultiSegment) { + iw.optimize(); + } iw.close(); } - private void addDoc(IndexWriter iw, int i) throws Exception { + private void addDoc(RandomIndexWriter iw, int i) throws Exception { Document d = new Document(); Fieldable f; int scoreAndID = i + 1; Index: lucene/src/test/org/apache/lucene/search/QueryUtils.java =================================================================== --- lucene/src/test/org/apache/lucene/search/QueryUtils.java (revision 980434) +++ lucene/src/test/org/apache/lucene/search/QueryUtils.java (working copy) @@ -378,7 +378,7 @@ // check that first skip on just created scorers always goes to the right doc private static void checkFirstSkipTo(final Query q, final IndexSearcher s) throws IOException { //System.out.println("checkFirstSkipTo: "+q); - final float maxDiff = 1e-5f; + final float maxDiff = 1e-3f; final int lastDoc[] = {-1}; final IndexReader lastReader[] = {null};