lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r821340 [2/3] - in /lucene/java/trunk: ./ src/test/org/apache/lucene/ src/test/org/apache/lucene/analysis/ src/test/org/apache/lucene/document/ src/test/org/apache/lucene/index/ src/test/org/apache/lucene/queryParser/ src/test/org/apache/lu...
Date Sat, 03 Oct 2009 15:45:37 GMT
Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java Sat Oct  3 15:45:34 2009
@@ -104,7 +104,7 @@
         writer.close();
 
         // delete 40 documents
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         for (i = 0; i < 40; i++) {
             reader.deleteDocument(i);
         }
@@ -115,7 +115,7 @@
         assertEquals(100, writer.docCount());
         writer.close();
 
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, true);
         assertEquals(100, reader.maxDoc());
         assertEquals(60, reader.numDocs());
         reader.close();
@@ -130,7 +130,7 @@
         writer.close();
 
         // check that the index reader gives the same numbers.
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, true);
         assertEquals(60, reader.maxDoc());
         assertEquals(60, reader.numDocs());
         reader.close();
@@ -202,7 +202,7 @@
 
       // Make sure starting index seems to be working properly:
       Term searchTerm = new Term("content", "aaa");        
-      IndexReader reader = IndexReader.open(startDir);
+      IndexReader reader = IndexReader.open(startDir, true);
       assertEquals("first docFreq", 57, reader.docFreq(searchTerm));
 
       IndexSearcher searcher = new IndexSearcher(reader);
@@ -315,7 +315,7 @@
               } else if (1 == method) {
                 IndexReader readers[] = new IndexReader[dirs.length];
                 for(int i=0;i<dirs.length;i++) {
-                  readers[i] = IndexReader.open(dirs[i]);
+                  readers[i] = IndexReader.open(dirs[i], true);
                 }
                 try {
                   writer.addIndexes(readers);
@@ -387,7 +387,7 @@
             // failed, we see either all docs or no docs added
             // (transactional semantics):
             try {
-              reader = IndexReader.open(dir);
+              reader = IndexReader.open(dir, true);
             } catch (IOException e) {
               e.printStackTrace(System.out);
               fail(testName + ": exception when creating IndexReader: " + e);
@@ -538,7 +538,7 @@
             assertNoUnreferencedFiles(dir, "after disk full during addDocument with autoCommit=" + autoCommit);
 
             // Make sure reader can open the index:
-            IndexReader.open(dir).close();
+            IndexReader.open(dir, true).close();
 
             dir.close();
 
@@ -592,7 +592,7 @@
       writer.addDocument(doc);
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
 
       // Make sure all terms < max size were indexed
       assertEquals(2, reader.docFreq(new Term("content", "abc")));
@@ -622,7 +622,7 @@
       writer  = new IndexWriter(dir, sa, IndexWriter.MaxFieldLength.LIMITED);
       writer.addDocument(doc);
       writer.close();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(1, reader.docFreq(new Term("content", bigTerm)));
       reader.close();
 
@@ -765,7 +765,7 @@
           writer.close();
 
           // now open reader:
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, true);
           assertEquals("should be one document", reader.numDocs(), 1);
 
           // now open index for create:
@@ -775,7 +775,7 @@
           writer.close();
 
           assertEquals("should be one document", reader.numDocs(), 1);
-          IndexReader reader2 = IndexReader.open(dir);
+          IndexReader reader2 = IndexReader.open(dir, true);
           assertEquals("should be one document", reader2.numDocs(), 1);
           reader.close();
           reader2.close();
@@ -784,68 +784,6 @@
         }
     }
 
-
-    // Same test as above, but use IndexWriter constructor
-    // that takes File:
-    public void testCreateWithReader2() throws IOException {
-        File indexDir = _TestUtil.getTempDir("lucenetestindexwriter");
-        try {
-          // add one document & close writer
-          IndexWriter writer = new IndexWriter(indexDir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-          addDoc(writer);
-          writer.close();
-
-          // now open reader:
-          IndexReader reader = IndexReader.open(indexDir);
-          assertEquals("should be one document", reader.numDocs(), 1);
-
-          // now open index for create:
-          writer = new IndexWriter(indexDir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-          assertEquals("should be zero documents", writer.docCount(), 0);
-          addDoc(writer);
-          writer.close();
-
-          assertEquals("should be one document", reader.numDocs(), 1);
-          IndexReader reader2 = IndexReader.open(indexDir);
-          assertEquals("should be one document", reader2.numDocs(), 1);
-          reader.close();
-          reader2.close();
-        } finally {
-          rmDir(indexDir);
-        }
-    }
-
-    // Same test as above, but use IndexWriter constructor
-    // that takes String:
-    public void testCreateWithReader3() throws IOException {
-        File dirName = _TestUtil.getTempDir("lucenetestindexwriter");
-        try {
-
-          // add one document & close writer
-          IndexWriter writer = new IndexWriter(dirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-          addDoc(writer);
-          writer.close();
-
-          // now open reader:
-          IndexReader reader = IndexReader.open(dirName);
-          assertEquals("should be one document", reader.numDocs(), 1);
-
-          // now open index for create:
-          writer = new IndexWriter(dirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-          assertEquals("should be zero documents", writer.docCount(), 0);
-          addDoc(writer);
-          writer.close();
-
-          assertEquals("should be one document", reader.numDocs(), 1);
-          IndexReader reader2 = IndexReader.open(dirName);
-          assertEquals("should be one document", reader2.numDocs(), 1);
-          reader.close();
-          reader2.close();
-        } finally {
-          rmDir(dirName);
-        }
-    }
-
     // Simulate a writer that crashed while writing segments
     // file: make sure we can still open the index (ie,
     // gracefully fallback to the previous segments file),
@@ -886,7 +824,7 @@
 
         IndexReader reader = null;
         try {
-          reader = IndexReader.open(dir);
+          reader = IndexReader.open(dir, true);
         } catch (Exception e) {
           fail("reader failed to open on a crashed index");
         }
@@ -944,7 +882,7 @@
 
         IndexReader reader = null;
         try {
-          reader = IndexReader.open(dir);
+          reader = IndexReader.open(dir, true);
           fail("reader did not hit IOException on opening a corrupt index");
         } catch (Exception e) {
         }
@@ -1003,7 +941,7 @@
 
         IndexReader reader = null;
         try {
-          reader = IndexReader.open(dir);
+          reader = IndexReader.open(dir, true);
           fail("reader did not hit IOException on opening a corrupt index");
         } catch (Exception e) {
         }
@@ -1027,19 +965,19 @@
         writer.close();
 
         Term searchTerm = new Term("content", "aaa");        
-        IndexSearcher searcher = new IndexSearcher(dir);
+        IndexSearcher searcher = new IndexSearcher(dir, false);
         ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
         assertEquals("first number of hits", 14, hits.length);
         searcher.close();
 
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
 
         writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
         for(int i=0;i<3;i++) {
           for(int j=0;j<11;j++) {
             addDoc(writer);
           }
-          searcher = new IndexSearcher(dir);
+          searcher = new IndexSearcher(dir, false);
           hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
           assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length);
           searcher.close();
@@ -1050,7 +988,7 @@
         writer.close();
         assertFalse("reader should not be current now", reader.isCurrent());
 
-        searcher = new IndexSearcher(dir);
+        searcher = new IndexSearcher(dir, false);
         hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
         assertEquals("reader did not see changes after writer was closed", 47, hits.length);
         searcher.close();
@@ -1075,7 +1013,7 @@
       writer.close();
 
       Term searchTerm = new Term("content", "aaa");        
-      IndexSearcher searcher = new IndexSearcher(dir);
+      IndexSearcher searcher = new IndexSearcher(dir, false);
       ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals("first number of hits", 14, hits.length);
       searcher.close();
@@ -1088,7 +1026,7 @@
       // Delete all docs:
       writer.deleteDocuments(searchTerm);
 
-      searcher = new IndexSearcher(dir);
+      searcher = new IndexSearcher(dir, false);
       hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length);
       searcher.close();
@@ -1098,7 +1036,7 @@
 
       assertNoUnreferencedFiles(dir, "unreferenced files remain after abort()");
 
-      searcher = new IndexSearcher(dir);
+      searcher = new IndexSearcher(dir, false);
       hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals("saw changes after writer.abort", 14, hits.length);
       searcher.close();
@@ -1116,14 +1054,14 @@
         for(int j=0;j<17;j++) {
           addDoc(writer);
         }
-        searcher = new IndexSearcher(dir);
+        searcher = new IndexSearcher(dir, false);
         hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
         assertEquals("reader incorrectly sees changes from writer with autoCommit disabled", 14, hits.length);
         searcher.close();
       }
 
       writer.close();
-      searcher = new IndexSearcher(dir);
+      searcher = new IndexSearcher(dir, false);
       hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals("didn't see changes after close", 218, hits.length);
       searcher.close();
@@ -1159,7 +1097,7 @@
       writer.optimize();
       writer.close();
 
-      IndexReader.open(dir).close();
+      IndexReader.open(dir, true).close();
 
       long endDiskUsage = dir.getMaxUsedSizeInBytes();
 
@@ -1194,7 +1132,7 @@
       writer.optimize();
 
       // Open a reader before closing (commiting) the writer:
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
 
       // Reader should see index as unoptimized at this
       // point:
@@ -1206,7 +1144,7 @@
       assertNoUnreferencedFiles(dir, "aborted writer after optimize");
 
       // Open a reader after aborting writer:
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
 
       // Reader should still see index as unoptimized:
       assertFalse("Reader incorrectly sees that the index is optimized", reader.isOptimized());
@@ -1218,7 +1156,7 @@
       assertNoUnreferencedFiles(dir, "aborted writer after optimize");
 
       // Open a reader after aborting writer:
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
 
       // Reader should still see index as unoptimized:
       assertTrue("Reader incorrectly sees that the index is unoptimized", reader.isOptimized());
@@ -1231,7 +1169,7 @@
       writer.flush();
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(0, reader.maxDoc());
       assertEquals(0, reader.numDocs());
       reader.close();
@@ -1240,7 +1178,7 @@
       writer.flush();
       writer.close();
 
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(0, reader.maxDoc());
       assertEquals(0, reader.numDocs());
       reader.close();
@@ -1262,7 +1200,7 @@
       }
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(100, reader.maxDoc());
       assertEquals(100, reader.numDocs());
       for(int j=0;j<100;j++) {
@@ -1453,7 +1391,7 @@
       }
       writer.close();
 
-      IndexSearcher searcher = new IndexSearcher(dir);
+      IndexSearcher searcher = new IndexSearcher(dir, false);
       ScoreDoc[] hits = searcher.search(new TermQuery(new Term("field", "aaa")), null, 1000).scoreDocs;
       assertEquals(300, hits.length);
       searcher.close();
@@ -1479,7 +1417,7 @@
 
       Term searchTerm = new Term("field", "aaa");
 
-      IndexSearcher searcher = new IndexSearcher(dir);
+      IndexSearcher searcher = new IndexSearcher(dir, false);
       ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals(10, hits.length);
       searcher.close();
@@ -1497,12 +1435,12 @@
         writer.addDocument(doc);
       }
       writer.close();
-      searcher = new IndexSearcher(dir);
+      searcher = new IndexSearcher(dir, false);
       hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals(27, hits.length);
       searcher.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       reader.close();
 
       dir.close();
@@ -1525,7 +1463,7 @@
       writer.addDocument(doc);
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(1, reader.maxDoc());
       assertEquals(1, reader.numDocs());
       Term t = new Term("field", "a");
@@ -1562,7 +1500,7 @@
       }
       writer.close();
       Term searchTerm = new Term("content", "aaa");        
-      IndexSearcher searcher = new IndexSearcher(dir);
+      IndexSearcher searcher = new IndexSearcher(dir, false);
       ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
       assertEquals("did not get right number of hits", 100, hits.length);
       writer.close();
@@ -1602,7 +1540,7 @@
       writer.addDocument(new Document());
       writer.close();
       _TestUtil.checkIndex(dir);
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(2, reader.numDocs());
     }
 
@@ -1625,7 +1563,7 @@
 
         if (0 == pass) {
           writer.close();
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, true);
           assertTrue(reader.isOptimized());
           reader.close();
         } else {
@@ -1635,7 +1573,7 @@
           writer.addDocument(doc);
           writer.close();
 
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, true);
           assertTrue(!reader.isOptimized());
           reader.close();
 
@@ -1832,7 +1770,7 @@
     writer.addDocument(doc);
 
     writer.close();
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     final Term t = new Term("content", "aa");
     assertEquals(reader.docFreq(t), 3);
 
@@ -1907,7 +1845,7 @@
     }
     assertTrue(hitError);
     writer.close();
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(198, reader.docFreq(new Term("content", "aa")));
     reader.close();
   }
@@ -1968,7 +1906,7 @@
       }
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       int expected = 3+(1-i)*2;
       assertEquals(expected, reader.docFreq(new Term("contents", "here")));
       assertEquals(expected, reader.maxDoc());
@@ -1995,7 +1933,7 @@
       writer.optimize();
       writer.close();
 
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       expected = 19+(1-i)*2;
       assertEquals(expected, reader.docFreq(new Term("contents", "here")));
       assertEquals(expected, reader.maxDoc());
@@ -2080,7 +2018,7 @@
         writer.close();
       }
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       int expected = (3+(1-i)*2)*NUM_THREAD*NUM_ITER;
       assertEquals(expected, reader.docFreq(new Term("contents", "here")));
       assertEquals(expected, reader.maxDoc());
@@ -2107,7 +2045,7 @@
       writer.optimize();
       writer.close();
 
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       expected += 17-NUM_THREAD*NUM_ITER;
       assertEquals(expected, reader.docFreq(new Term("contents", "here")));
       assertEquals(expected, reader.maxDoc());
@@ -2162,7 +2100,7 @@
         writer.addDocument(doc);
 
       writer.close();
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       reader.deleteDocument(delID++);
       reader.close();
 
@@ -2251,7 +2189,7 @@
         t1.join();
 
         // Make sure reader can read
-        IndexReader reader = IndexReader.open(directory);
+        IndexReader reader = IndexReader.open(directory, true);
         reader.close();
 
         // Reopen
@@ -2376,7 +2314,7 @@
       }
 
       // Quick test to make sure index is not corrupt:
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       TermDocs tdocs = reader.termDocs(new Term("field", "aaa"));
       int count = 0;
       while(tdocs.next()) {
@@ -2552,7 +2490,7 @@
       }
 
       if (success) {
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
         for(int j=0;j<reader.maxDoc();j++) {
           if (!reader.isDeleted(j)) {
             reader.document(j);
@@ -2685,7 +2623,7 @@
     writer.addDocument(doc);
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     Term t = new Term("field", "x");
     assertEquals(1, reader.docFreq(t));
     reader.close();
@@ -2722,7 +2660,7 @@
 
     IndexReader reader = null;
     try {
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
     } catch (IOException e) {
       e.printStackTrace(System.out);
       fail("segmentInfos failed to retry fallback to correct segments_N file");
@@ -2741,7 +2679,7 @@
     for (int i = 0; i < 23; i++)
       addDoc(writer);
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(0, reader.numDocs());
     writer.commit();
     IndexReader reader2 = reader.reopen();
@@ -2753,12 +2691,12 @@
       addDoc(writer);
     assertEquals(23, reader2.numDocs());
     reader2.close();
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(23, reader.numDocs());
     reader.close();
     writer.commit();
 
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(40, reader.numDocs());
     reader.close();
     writer.close();
@@ -2805,7 +2743,7 @@
     failure.clearDoFail();
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(23, reader.numDocs());
     reader.close();
     dir.close();
@@ -2843,7 +2781,7 @@
       writer.optimize();
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       for(int i=0;i<reader.numDocs();i++) {
         reader.document(i);
         reader.getTermFreqVectors(i);
@@ -2894,7 +2832,7 @@
       writer.optimize();
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertTrue(reader.getTermFreqVectors(0)==null);
       assertTrue(reader.getTermFreqVectors(1)==null);
       assertTrue(reader.getTermFreqVectors(2)!=null);
@@ -2941,7 +2879,7 @@
     writer.optimize();
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     for(int i=0;i<10;i++) {
       reader.getTermFreqVectors(i);
       reader.document(i);
@@ -2965,7 +2903,7 @@
     writer.addDocument(doc);
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     Term t = new Term("field", "x");
     assertEquals(1, reader.docFreq(t));
     reader.close();
@@ -2996,7 +2934,7 @@
       writer.addDocument(document);
     writer.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     assertEquals(10, ir.maxDoc());
     assertEquals(10, ir.numDocs());
     ir.deleteDocument(0);
@@ -3012,7 +2950,7 @@
     writer.expungeDeletes();
     assertEquals(8, writer.numDocs());
     writer.close();
-    ir = IndexReader.open(dir);
+    ir = IndexReader.open(dir, true);
     assertEquals(8, ir.maxDoc());
     assertEquals(8, ir.numDocs());
     ir.close();
@@ -3043,7 +2981,7 @@
       writer.addDocument(document);
     writer.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     assertEquals(98, ir.maxDoc());
     assertEquals(98, ir.numDocs());
     for(int i=0;i<98;i+=2)
@@ -3058,7 +2996,7 @@
     assertEquals(49, writer.numDocs());
     writer.expungeDeletes();
     writer.close();
-    ir = IndexReader.open(dir);
+    ir = IndexReader.open(dir, true);
     assertEquals(49, ir.maxDoc());
     assertEquals(49, ir.numDocs());
     ir.close();
@@ -3090,7 +3028,7 @@
       writer.addDocument(document);
     writer.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     assertEquals(98, ir.maxDoc());
     assertEquals(98, ir.numDocs());
     for(int i=0;i<98;i+=2)
@@ -3105,7 +3043,7 @@
     writer.setMergeFactor(3);
     writer.expungeDeletes(false);
     writer.close();
-    ir = IndexReader.open(dir);
+    ir = IndexReader.open(dir, true);
     assertEquals(49, ir.maxDoc());
     assertEquals(49, ir.numDocs());
     ir.close();
@@ -3258,7 +3196,7 @@
     assertTrue(w.wasCalled);
     w.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, true);
     assertEquals(1, ir.maxDoc());
     assertEquals(0, ir.numDocs());
     ir.close();
@@ -3354,7 +3292,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, true);
     Document doc2 = ir.document(0);
     for(int i=0;i<count;i++) {
       assertEquals("field " + i + " was not indexed correctly", 1, ir.docFreq(new Term("f"+i, utf8Data[2*i+1])));
@@ -3563,7 +3501,7 @@
     w.addDocument(doc);
     w.commit();
 
-    IndexSearcher s = new IndexSearcher(dir);
+    IndexSearcher s = new IndexSearcher(dir, false);
     PhraseQuery pq = new PhraseQuery();
     pq.add(new Term("field", "a"));
     pq.add(new Term("field", "b"));
@@ -3596,12 +3534,12 @@
     for (int i = 0; i < 23; i++)
       addDoc(writer);
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(0, reader.numDocs());
 
     writer.prepareCommit();
 
-    IndexReader reader2 = IndexReader.open(dir);
+    IndexReader reader2 = IndexReader.open(dir, true);
     assertEquals(0, reader2.numDocs());
 
     writer.commit();
@@ -3618,18 +3556,18 @@
 
     assertEquals(23, reader3.numDocs());
     reader3.close();
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(23, reader.numDocs());
     reader.close();
 
     writer.prepareCommit();
 
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(23, reader.numDocs());
     reader.close();
 
     writer.commit();
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(40, reader.numDocs());
     reader.close();
     writer.close();
@@ -3649,12 +3587,12 @@
     for (int i = 0; i < 23; i++)
       addDoc(writer);
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(0, reader.numDocs());
 
     writer.prepareCommit();
 
-    IndexReader reader2 = IndexReader.open(dir);
+    IndexReader reader2 = IndexReader.open(dir, true);
     assertEquals(0, reader2.numDocs());
 
     writer.rollback();
@@ -3672,18 +3610,18 @@
 
     assertEquals(0, reader3.numDocs());
     reader3.close();
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(0, reader.numDocs());
     reader.close();
 
     writer.prepareCommit();
 
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(0, reader.numDocs());
     reader.close();
 
     writer.commit();
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(17, reader.numDocs());
     reader.close();
     writer.close();
@@ -3699,7 +3637,7 @@
     writer.commit();
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(0, reader.numDocs());
     reader.close();
     dir.close();
@@ -3733,7 +3671,7 @@
 
       readers = new IndexReader[NUM_COPY];
       for(int i=0;i<NUM_COPY;i++)
-        readers[i] = IndexReader.open(dir);
+        readers[i] = IndexReader.open(dir, true);
     }
 
     void launchThreads(final int numIter) {
@@ -3837,7 +3775,7 @@
 
     _TestUtil.checkIndex(c.dir2);
 
-    IndexReader reader = IndexReader.open(c.dir2);
+    IndexReader reader = IndexReader.open(c.dir2, true);
     assertEquals(100+NUM_COPY*(3*NUM_ITER/4)*c.NUM_THREADS*c.NUM_INIT_DOCS, reader.numDocs());
     reader.close();
 
@@ -4019,7 +3957,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, true);
     doc = ir.document(0);
     f = doc.getField("binary");
     b = f.getBinaryValue();
@@ -4055,7 +3993,7 @@
 
       byte[] cmp = new byte[20];
 
-      IndexReader r = IndexReader.open(dir);
+      IndexReader r = IndexReader.open(dir, true);
       try {
         for(int i=0;i<5;i++) {
           Document doc = r.document(i);
@@ -4083,7 +4021,7 @@
 
     assertEquals(0, IndexReader.getCommitUserData(dir).size());
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     // commit(Map) never called for this index
     assertEquals(0, r.getCommitUserData().size());
     r.close();
@@ -4099,7 +4037,7 @@
       
     assertEquals("test1", IndexReader.getCommitUserData(dir).get("label"));
 
-    r = IndexReader.open(dir);
+    r = IndexReader.open(dir, true);
     assertEquals("test1", r.getCommitUserData().get("label"));
     r.close();
 
@@ -4177,7 +4115,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermVectorOffsetInfo[] termOffsets = ((TermPositionVector) r.getTermFreqVector(0, "field")).getOffsets(0);
 
     // Token "" occurred once
@@ -4209,7 +4147,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermVectorOffsetInfo[] termOffsets = ((TermPositionVector) r.getTermFreqVector(0, "field")).getOffsets(0);
     assertEquals(2, termOffsets.length);
     assertEquals(0, termOffsets[0].getStartOffset());
@@ -4231,7 +4169,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermVectorOffsetInfo[] termOffsets = ((TermPositionVector) r.getTermFreqVector(0, "field")).getOffsets(0);
     assertEquals(2, termOffsets.length);
     assertEquals(0, termOffsets[0].getStartOffset());
@@ -4255,7 +4193,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermVectorOffsetInfo[] termOffsets = ((TermPositionVector) r.getTermFreqVector(0, "field")).getOffsets(0);
     assertEquals(2, termOffsets.length);
     assertEquals(0, termOffsets[0].getStartOffset());
@@ -4281,7 +4219,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermVectorOffsetInfo[] termOffsets = ((TermPositionVector) r.getTermFreqVector(0, "field")).getOffsets(0);
     assertEquals(2, termOffsets.length);
     assertEquals(0, termOffsets[0].getStartOffset());
@@ -4303,7 +4241,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermVectorOffsetInfo[] termOffsets = ((TermPositionVector) r.getTermFreqVector(0, "field")).getOffsets(0);
     assertEquals(2, termOffsets.length);
     assertEquals(0, termOffsets[0].getStartOffset());
@@ -4328,7 +4266,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermPositionVector tpv = ((TermPositionVector) r.getTermFreqVector(0, "field"));
     TermVectorOffsetInfo[] termOffsets = tpv.getOffsets(0);
     assertEquals(1, termOffsets.length);
@@ -4358,7 +4296,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermPositionVector tpv = ((TermPositionVector) r.getTermFreqVector(0, "field"));
     TermVectorOffsetInfo[] termOffsets = tpv.getOffsets(0);
     assertEquals(1, termOffsets.length);
@@ -4389,7 +4327,7 @@
     w.addDocument(doc);
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     TermPositionVector tpv = ((TermPositionVector) r.getTermFreqVector(0, "field"));
     TermVectorOffsetInfo[] termOffsets = tpv.getOffsets(0);
     assertEquals(1, termOffsets.length);
@@ -4448,12 +4386,12 @@
     writer2.addDocument(doc);
     writer2.close();
 
-    IndexReader r1 = IndexReader.open(dir2);
+    IndexReader r1 = IndexReader.open(dir2, true);
     IndexReader r2 = (IndexReader) r1.clone();
     writer.addIndexes(new IndexReader[] {r1, r2});
     writer.close();
 
-    IndexReader r3 = IndexReader.open(dir);
+    IndexReader r3 = IndexReader.open(dir, true);
     assertEquals(5, r3.numDocs());
     r3.close();
 
@@ -4532,7 +4470,7 @@
           e.printStackTrace(System.out);
         }
         try {
-          IndexReader r = IndexReader.open(dir);
+          IndexReader r = IndexReader.open(dir, true);
           //System.out.println("doc count=" + r.numDocs());
           r.close();
         } catch (Exception e) {
@@ -4594,7 +4532,7 @@
     w.commit();
     w.optimize();   // force segment merge.
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, true);
     doc = ir.document(0);
     f = doc.getField("binary");
     b = f.getBinaryValue();

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterDelete.java Sat Oct  3 15:45:34 2009
@@ -102,7 +102,7 @@
 
       modifier.commit();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(7, reader.numDocs());
       reader.close();
 
@@ -110,7 +110,7 @@
 
       modifier.commit();
 
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(0, reader.numDocs());
       reader.close();
       modifier.close();
@@ -168,7 +168,7 @@
 
         modifier.commit();
 
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
         assertEquals(1, reader.numDocs());
 
         int hitCount = getHitCount(dir, new Term("id", String.valueOf(id)));
@@ -211,7 +211,7 @@
 
       modifier.commit();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(5, reader.numDocs());
       modifier.close();
     }
@@ -235,7 +235,7 @@
       }
       modifier.commit();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(7, reader.numDocs());
       reader.close();
       
@@ -245,7 +245,7 @@
 
       modifier.commit();
 
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(5, reader.numDocs());
       reader.close();
 
@@ -255,7 +255,7 @@
       }
       modifier.deleteDocuments(terms);
       modifier.commit();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(2, reader.numDocs());
       reader.close();
 
@@ -282,7 +282,7 @@
       }
       modifier.commit();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       assertEquals(7, reader.numDocs());
       reader.close();
 
@@ -293,7 +293,7 @@
       modifier.deleteAll();
 
       // Delete all shouldn't be on disk yet
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(7, reader.numDocs());
       reader.close();
 
@@ -305,7 +305,7 @@
       modifier.commit();
 
       // Validate there are no docs left
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, true);
       assertEquals(2, reader.numDocs());
       reader.close();
 
@@ -332,7 +332,7 @@
     
     addDoc(modifier, ++id, value);
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(7, reader.numDocs());
     reader.close();
     
@@ -344,7 +344,7 @@
     modifier.close();
     
     // Validate that the docs are still there
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(7, reader.numDocs());
     reader.close();
     
@@ -388,7 +388,7 @@
     modifier.close();
     
     // Validate that the docs are still there
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, true);
     assertEquals(7, reader.numDocs());
     reader.close();
     
@@ -420,7 +420,7 @@
   }
 
   private int getHitCount(Directory dir, Term term) throws IOException {
-    IndexSearcher searcher = new IndexSearcher(dir);
+    IndexSearcher searcher = new IndexSearcher(dir, true);
     int hitCount = searcher.search(new TermQuery(term), null, 1000).totalHits;
     searcher.close();
     return hitCount;
@@ -567,7 +567,7 @@
           // changed (transactional semantics):
           IndexReader newReader = null;
           try {
-            newReader = IndexReader.open(dir);
+            newReader = IndexReader.open(dir, true);
           }
           catch (IOException e) {
             e.printStackTrace();

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java Sat Oct  3 15:45:34 2009
@@ -158,7 +158,7 @@
     }
 
     // Confirm that when doc hits exception partway through tokenization, it's deleted:
-    IndexReader r2 = IndexReader.open(dir);
+    IndexReader r2 = IndexReader.open(dir, true);
     final int count = r2.docFreq(new Term("content4", "aaa"));
     final int count2 = r2.docFreq(new Term("content4", "ddd"));
     assertEquals(count, count2);
@@ -204,7 +204,7 @@
     }
 
     // Confirm that when doc hits exception partway through tokenization, it's deleted:
-    IndexReader r2 = IndexReader.open(dir);
+    IndexReader r2 = IndexReader.open(dir, true);
     final int count = r2.docFreq(new Term("content4", "aaa"));
     final int count2 = r2.docFreq(new Term("content4", "ddd"));
     assertEquals(count, count2);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java Sat Oct  3 15:45:34 2009
@@ -178,7 +178,7 @@
     }
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     reader.deleteDocuments(new Term("content", "aaa"));
     reader.close();
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMerging.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterMerging.java Sat Oct  3 15:45:34 2009
@@ -71,7 +71,7 @@
   private boolean verifyIndex(Directory directory, int startAt) throws IOException
   {
     boolean fail = false;
-    IndexReader reader = IndexReader.open(directory);
+    IndexReader reader = IndexReader.open(directory, true);
 
     int max = reader.maxDoc();
     for (int i = 0; i < max; i++)

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java Sat Oct  3 15:45:34 2009
@@ -101,7 +101,7 @@
     r2.close();
     writer.close();
     
-    IndexReader r3 = IndexReader.open(dir1);
+    IndexReader r3 = IndexReader.open(dir1, true);
     assertEquals(0, count(new Term("id", id10), r3));
     assertEquals(1, count(new Term("id", Integer.toString(8000)), r3));
     r3.close();
@@ -262,7 +262,7 @@
 
     _TestUtil.checkIndex(mainDir);
 
-    IndexReader reader = IndexReader.open(mainDir);
+    IndexReader reader = IndexReader.open(mainDir, true);
     assertEquals(addDirThreads.count.intValue(), reader.numDocs());
     //assertEquals(100 + numDirs * (3 * numIter / 4) * addDirThreads.NUM_THREADS
     //    * addDirThreads.NUM_INIT_DOCS, reader.numDocs());
@@ -364,7 +364,7 @@
       
       readers = new IndexReader[numDirs];
       for (int i = 0; i < numDirs; i++)
-        readers[i] = IndexReader.open(addDir);
+        readers[i] = IndexReader.open(addDir, false);
     }
     
     void joinThreads() {
@@ -824,7 +824,7 @@
     w.expungeDeletes();
     w.close();
     r.close();
-    r = IndexReader.open(dir);
+    r = IndexReader.open(dir, true);
     assertEquals(1, r.numDocs());
     assertFalse(r.hasDeletions());
     r.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyBug.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyBug.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyBug.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyBug.java Sat Oct  3 15:45:34 2009
@@ -88,7 +88,7 @@
   
   public void doTest(int[] docs) throws Exception {
     Directory dir = makeIndex();
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     for (int i = 0; i < docs.length; i++) {
       Document d = reader.document(docs[i], SELECTOR);
       d.get(MAGIC_FIELD);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyProxSkipping.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyProxSkipping.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestLazyProxSkipping.java Sat Oct  3 15:45:34 2009
@@ -125,7 +125,7 @@
         }
         
         writer.close();
-        IndexReader reader = IndexReader.open(directory);
+        IndexReader reader = IndexReader.open(directory, true);
         TermPositions tp = reader.termPositions();
         tp.seek(new Term(this.field, "b"));
         for (int i = 0; i < 10; i++) {

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestNorms.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestNorms.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestNorms.java Sat Oct  3 15:45:34 2009
@@ -161,7 +161,7 @@
   }
 
   private void modifyNormsForF1(Directory dir) throws IOException {
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     int n = ir.maxDoc();
     for (int i = 0; i < n; i+=3) { // modify for every third doc
       int k = (i*3) % modifiedNorms.size();
@@ -179,7 +179,7 @@
 
 
   private void verifyIndex(Directory dir) throws IOException {
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     for (int i = 0; i < NUM_FIELDS; i++) {
       String field = "f"+i;
       byte b[] = ir.norms(field);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestOmitTf.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestOmitTf.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestOmitTf.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestOmitTf.java Sat Oct  3 15:45:34 2009
@@ -267,7 +267,7 @@
     /*
      * Verify the index
      */         
-    Searcher searcher = new IndexSearcher(dir);
+    Searcher searcher = new IndexSearcher(dir, true);
     searcher.setSimilarity(new SimpleSimilarity());
         
     Term a = new Term("noTf", term);

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelReader.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelReader.java Sat Oct  3 15:45:34 2009
@@ -68,8 +68,8 @@
     Directory dir1 = getDir1();
     Directory dir2 = getDir2();
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     Collection fieldNames = pr.getFieldNames(IndexReader.FieldOption.ALL);
     assertEquals(4, fieldNames.size());
     assertTrue(fieldNames.contains("f1"));
@@ -82,8 +82,8 @@
     Directory dir1 = getDir1();
     Directory dir2 = getDir2();
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
 
     Document doc11 = pr.document(0, new MapFieldSelector(new String[] {"f1"}));
     Document doc24 = pr.document(1, new MapFieldSelector(Arrays.asList(new String[] {"f4"})));
@@ -112,9 +112,9 @@
     w2.close();
     
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
+    pr.add(IndexReader.open(dir1, false));
     try {
-      pr.add(IndexReader.open(dir2));
+      pr.add(IndexReader.open(dir2, false));
       fail("didn't get exptected exception: indexes don't have same number of documents");
     } catch (IllegalArgumentException e) {
       // expected exception
@@ -125,11 +125,11 @@
     Directory dir1 = getDir1();
     Directory dir2 = getDir2();
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     
     assertTrue(pr.isCurrent());
-    IndexReader modifier = IndexReader.open(dir1);
+    IndexReader modifier = IndexReader.open(dir1, false);
     modifier.setNorm(0, "f1", 100);
     modifier.close();
     
@@ -137,7 +137,7 @@
     // is not current anymore
     assertFalse(pr.isCurrent());
     
-    modifier = IndexReader.open(dir2);
+    modifier = IndexReader.open(dir2, false);
     modifier.setNorm(0, "f3", 100);
     modifier.close();
     
@@ -164,8 +164,8 @@
 
     
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     assertFalse(pr.isOptimized());
     pr.close();
     
@@ -174,8 +174,8 @@
     modifier.close();
     
     pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     // just one of the two indexes are optimized
     assertFalse(pr.isOptimized());
     pr.close();
@@ -186,8 +186,8 @@
     modifier.close();
     
     pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     // now both indexes are optimized
     assertTrue(pr.isOptimized());
     pr.close();
@@ -198,8 +198,8 @@
     Directory dir1 = getDir1();
     Directory dir2 = getDir2();
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     int NUM_DOCS = 2;
     TermDocs td = pr.termDocs(null);
     for(int i=0;i<NUM_DOCS;i++) {
@@ -247,7 +247,7 @@
     w.addDocument(d2);
     w.close();
 
-    return new IndexSearcher(dir);
+    return new IndexSearcher(dir, false);
   }
 
   // Fields 1 & 2 in one index, 3 & 4 in other, with ParallelReader:
@@ -255,8 +255,8 @@
     Directory dir1 = getDir1();
     Directory dir2 = getDir2();
     ParallelReader pr = new ParallelReader();
-    pr.add(IndexReader.open(dir1));
-    pr.add(IndexReader.open(dir2));
+    pr.add(IndexReader.open(dir1, false));
+    pr.add(IndexReader.open(dir2, false));
     return new IndexSearcher(pr);
   }
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelTermEnum.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelTermEnum.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestParallelTermEnum.java Sat Oct  3 15:45:34 2009
@@ -61,8 +61,8 @@
 
         iw2.close();
 
-        this.ir1 = IndexReader.open(rd1);
-        this.ir2 = IndexReader.open(rd2);
+        this.ir1 = IndexReader.open(rd1, true);
+        this.ir2 = IndexReader.open(rd2, true);
     }
 
     protected void tearDown() throws Exception {

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestPayloads.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestPayloads.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestPayloads.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestPayloads.java Sat Oct  3 15:45:34 2009
@@ -220,7 +220,7 @@
          * Verify the index
          * first we test if all payloads are stored correctly
          */        
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
         
         byte[] verifyPayloadData = new byte[payloadDataLength];
         offset = 0;
@@ -320,7 +320,7 @@
         // flush
         writer.close();
         
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, true);
         tp = reader.termPositions(new Term(fieldName, singleTerm));
         tp.next();
         tp.nextPosition();
@@ -492,7 +492,7 @@
           ingesters[i].join();
         }
         writer.close();
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
         TermEnum terms = reader.terms();
         while (terms.next()) {
             TermPositions tp = reader.termPositions(terms.term());

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermEnum.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermEnum.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestSegmentTermEnum.java Sat Oct  3 15:45:34 2009
@@ -81,7 +81,7 @@
   private void verifyDocFreq()
       throws IOException
   {
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       TermEnum termEnum = null;
 
     // create enumeration of all terms

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing.java Sat Oct  3 15:45:34 2009
@@ -106,7 +106,7 @@
 
     public void doWork() throws Throwable {
       for (int i=0; i<100; i++)
-        (new IndexSearcher(directory)).close();
+        (new IndexSearcher(directory, true)).close();
       count += 100;
     }
   }

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing2.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing2.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing2.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestStressIndexing2.java Sat Oct  3 15:45:34 2009
@@ -243,14 +243,14 @@
   }
   
   public static void verifyEquals(IndexReader r1, Directory dir2, String idField) throws Throwable {
-    IndexReader r2 = IndexReader.open(dir2);
+    IndexReader r2 = IndexReader.open(dir2, true);
     verifyEquals(r1, r2, idField);
     r2.close();
   }
 
   public static void verifyEquals(Directory dir1, Directory dir2, String idField) throws Throwable {
-    IndexReader r1 = IndexReader.open(dir1);
-    IndexReader r2 = IndexReader.open(dir2);
+    IndexReader r1 = IndexReader.open(dir1, true);
+    IndexReader r2 = IndexReader.open(dir2, true);
     verifyEquals(r1, r2, idField);
     r1.close();
     r2.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java Sat Oct  3 15:45:34 2009
@@ -342,7 +342,7 @@
     }
 
     // test setDocumentNumber()
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, true);
     DocNumAwareMapper docNumAwareMapper = new DocNumAwareMapper();
     assertEquals(-1, docNumAwareMapper.getDocumentNumber());
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestTermdocPerf.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestTermdocPerf.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestTermdocPerf.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestTermdocPerf.java Sat Oct  3 15:45:34 2009
@@ -92,7 +92,7 @@
     long end = System.currentTimeMillis();
     System.out.println("milliseconds for creation of " + ndocs + " docs = " + (end-start));
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     TermEnum tenum = reader.terms(new Term("foo","val"));
     TermDocs tdocs = reader.termDocs();
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestThreadedOptimize.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestThreadedOptimize.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestThreadedOptimize.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestThreadedOptimize.java Sat Oct  3 15:45:34 2009
@@ -124,7 +124,7 @@
         writer.setMaxBufferedDocs(2);
       }
 
-      IndexReader reader = IndexReader.open(directory);
+      IndexReader reader = IndexReader.open(directory, true);
       assertTrue(reader.isOptimized());
       assertEquals(expectedDocCount, reader.numDocs());
       reader.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactionRollback.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactionRollback.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactionRollback.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactionRollback.java Sat Oct  3 15:45:34 2009
@@ -88,7 +88,7 @@
   }
 	
   private void checkExpecteds(BitSet expecteds) throws Exception {
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
 		
     //Perhaps not the most efficient approach but meets our needs here.
     for (int i = 0; i < r.maxDoc(); i++) {
@@ -199,7 +199,7 @@
       new IndexWriter(dir,new WhitespaceAnalyzer(),
                       new DeleteLastCommitPolicy(),
                       MaxFieldLength.UNLIMITED).close();
-      IndexReader r = IndexReader.open(dir);
+      IndexReader r = IndexReader.open(dir, true);
       assertEquals(100, r.numDocs());
       r.close();
     }

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactions.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactions.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactions.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestTransactions.java Sat Oct  3 15:45:34 2009
@@ -161,8 +161,8 @@
     public void doWork() throws Throwable {
       IndexReader r1, r2;
       synchronized(lock) {
-        r1 = IndexReader.open(dir1);
-        r2 = IndexReader.open(dir2);
+        r1 = IndexReader.open(dir1, true);
+        r2 = IndexReader.open(dir2, true);
       }
       if (r1.numDocs() != r2.numDocs())
         throw new RuntimeException("doc counts differ: r1=" + r1.numDocs() + " r2=" + r2.numDocs());

Modified: lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java Sat Oct  3 15:45:34 2009
@@ -294,7 +294,7 @@
       new MultiFieldQueryParser(new String[] {"body"}, analyzer);
     mfqp.setDefaultOperator(QueryParser.Operator.AND);
     Query q = mfqp.parse("the footest");
-    IndexSearcher is = new IndexSearcher(ramDir);
+    IndexSearcher is = new IndexSearcher(ramDir, true);
     ScoreDoc[] hits = is.search(q, null, 1000).scoreDocs;
     assertEquals(1, hits.length);
     is.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/queryParser/TestQueryParser.java Sat Oct  3 15:45:34 2009
@@ -41,7 +41,6 @@
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.TermAttribute;
-import org.apache.lucene.document.DateField;
 import org.apache.lucene.document.DateTools;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -470,7 +469,7 @@
                       Field.Store.YES, Field.Index.UN_TOKENIZED));
     iw.addDocument(doc);
     iw.close();
-    IndexSearcher is = new IndexSearcher(ramDir);
+    IndexSearcher is = new IndexSearcher(ramDir, true);
 
     QueryParser qp = new QueryParser("content", new WhitespaceAnalyzer());
 
@@ -513,27 +512,6 @@
     }
   }
   
-  /** for testing legacy DateField support */
-  private String getLegacyDate(String s) throws Exception {
-    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
-    return DateField.dateToString(df.parse(s));
-  }
-
-  /** for testing DateTools support */
-  private String getDate(String s, DateTools.Resolution resolution) throws Exception {
-    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
-    return getDate(df.parse(s), resolution);      
-  }
-  
-  /** for testing DateTools support */
-  private String getDate(Date d, DateTools.Resolution resolution) throws Exception {
-      if (resolution == null) {
-        return DateField.dateToString(d);      
-      } else {
-        return DateTools.dateToString(d, resolution);
-      }
-    }
-  
   private String getLocalizedDate(int year, int month, int day, boolean extendLastDate) {
     DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
     Calendar calendar = new GregorianCalendar();
@@ -547,68 +525,6 @@
     return df.format(calendar.getTime());
   }
 
-  /** for testing legacy DateField support */
-  public void testLegacyDateRange() throws Exception {
-    String startDate = getLocalizedDate(2002, 1, 1, false);
-    String endDate = getLocalizedDate(2002, 1, 4, false);
-    Calendar endDateExpected = new GregorianCalendar();
-    endDateExpected.set(2002, 1, 4, 23, 59, 59);
-    endDateExpected.set(Calendar.MILLISECOND, 999);
-    assertQueryEquals("[ " + escapeDateString(startDate) + " TO " + escapeDateString(endDate) + "]", null,
-                      "[" + getLegacyDate(startDate) + " TO " + DateField.dateToString(endDateExpected.getTime()) + "]");
-    assertQueryEquals("{  " + escapeDateString(startDate) + "    " + escapeDateString(endDate) + "   }", null,
-                      "{" + getLegacyDate(startDate) + " TO " + getLegacyDate(endDate) + "}");
-  }
-  
-  public void testDateRange() throws Exception {
-    String startDate = getLocalizedDate(2002, 1, 1, false);
-    String endDate = getLocalizedDate(2002, 1, 4, false);
-    Calendar endDateExpected = new GregorianCalendar();
-    endDateExpected.set(2002, 1, 4, 23, 59, 59);
-    endDateExpected.set(Calendar.MILLISECOND, 999);
-    final String defaultField = "default";
-    final String monthField = "month";
-    final String hourField = "hour";
-    QueryParser qp = new QueryParser("field", new SimpleAnalyzer());
-    
-    // Don't set any date resolution and verify if DateField is used
-    assertDateRangeQueryEquals(qp, defaultField, startDate, endDate, 
-                               endDateExpected.getTime(), null);
-    
-    // set a field specific date resolution
-    qp.setDateResolution(monthField, DateTools.Resolution.MONTH);
-    
-    // DateField should still be used for defaultField
-    assertDateRangeQueryEquals(qp, defaultField, startDate, endDate, 
-                               endDateExpected.getTime(), null);
-    
-    // set default date resolution to MILLISECOND 
-    qp.setDateResolution(DateTools.Resolution.MILLISECOND);
-    
-    // set second field specific date resolution    
-    qp.setDateResolution(hourField, DateTools.Resolution.HOUR);
-
-    // for this field no field specific date resolution has been set,
-    // so verify if the default resolution is used
-    assertDateRangeQueryEquals(qp, defaultField, startDate, endDate, 
-            endDateExpected.getTime(), DateTools.Resolution.MILLISECOND);
-
-    // verify if field specific date resolutions are used for these two fields
-    assertDateRangeQueryEquals(qp, monthField, startDate, endDate, 
-            endDateExpected.getTime(), DateTools.Resolution.MONTH);
-
-    assertDateRangeQueryEquals(qp, hourField, startDate, endDate, 
-            endDateExpected.getTime(), DateTools.Resolution.HOUR);  
-  }
-  
-  public void assertDateRangeQueryEquals(QueryParser qp, String field, String startDate, String endDate, 
-                                         Date endDateInclusive, DateTools.Resolution resolution) throws Exception {
-    assertQueryEquals(qp, field, field + ":[" + escapeDateString(startDate) + " TO " + escapeDateString(endDate) + "]",
-               "[" + getDate(startDate, resolution) + " TO " + getDate(endDateInclusive, resolution) + "]");
-    assertQueryEquals(qp, field, field + ":{" + escapeDateString(startDate) + " TO " + escapeDateString(endDate) + "}",
-               "{" + getDate(startDate, resolution) + " TO " + getDate(endDate, resolution) + "}");
-  }
-
   public void testEscaped() throws Exception {
     Analyzer a = new WhitespaceAnalyzer();
     
@@ -870,22 +786,6 @@
     assertEquals(query1, query2);
   }
 
-  public void testLocalDateFormat() throws IOException, ParseException {
-    RAMDirectory ramDir = new RAMDirectory();
-    IndexWriter iw = new IndexWriter(ramDir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-    addDateDoc("a", 2005, 12, 2, 10, 15, 33, iw);
-    addDateDoc("b", 2005, 12, 4, 22, 15, 00, iw);
-    iw.close();
-    IndexSearcher is = new IndexSearcher(ramDir);
-    assertHits(1, "[12/1/2005 TO 12/3/2005]", is);
-    assertHits(2, "[12/1/2005 TO 12/4/2005]", is);
-    assertHits(1, "[12/3/2005 TO 12/4/2005]", is);
-    assertHits(1, "{12/1/2005 TO 12/3/2005}", is);
-    assertHits(1, "{12/1/2005 TO 12/4/2005}", is);
-    assertHits(0, "{12/3/2005 TO 12/4/2005}", is);
-    is.close();
-  }
-
   public void testStarParsing() throws Exception {
     final int[] type = new int[1];
     QueryParser qp = new QueryParser("field", new WhitespaceAnalyzer()) {
@@ -999,16 +899,6 @@
     assertEquals(expected, hits.length);
   }
 
-  private static void addDateDoc(String content, int year, int month,
-      int day, int hour, int minute, int second, IndexWriter iw) throws IOException {
-    Document d = new Document();
-    d.add(new Field("f", content, Field.Store.YES, Field.Index.ANALYZED));
-    Calendar cal = Calendar.getInstance(Locale.ENGLISH);
-    cal.set(year, month-1, day, hour, minute, second);
-    d.add(new Field("date", DateField.dateToString(cal.getTime()), Field.Store.YES, Field.Index.NOT_ANALYZED));
-    iw.addDocument(d);
-  }
-
   public void tearDown() throws Exception {
     super.tearDown();
     BooleanQuery.setMaxClauseCount(originalMaxClauses);

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/QueryUtils.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/QueryUtils.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/QueryUtils.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/QueryUtils.java Sat Oct  3 15:45:34 2009
@@ -145,19 +145,19 @@
     // we can't put deleted docs before the nested reader, because
     // it will throw off the docIds
     IndexReader[] readers = new IndexReader[] {
-      edge < 0 ? r : IndexReader.open(makeEmptyIndex(0)),
-      IndexReader.open(makeEmptyIndex(0)),
+      edge < 0 ? r : IndexReader.open(makeEmptyIndex(0), true),
+      IndexReader.open(makeEmptyIndex(0), true),
       new MultiReader(new IndexReader[] {
-        IndexReader.open(makeEmptyIndex(edge < 0 ? 4 : 0)),
-        IndexReader.open(makeEmptyIndex(0)),
-        0 == edge ? r : IndexReader.open(makeEmptyIndex(0))
+        IndexReader.open(makeEmptyIndex(edge < 0 ? 4 : 0), true),
+        IndexReader.open(makeEmptyIndex(0), true),
+        0 == edge ? r : IndexReader.open(makeEmptyIndex(0), true)
       }),
-      IndexReader.open(makeEmptyIndex(0 < edge ? 0 : 7)),
-      IndexReader.open(makeEmptyIndex(0)),
+      IndexReader.open(makeEmptyIndex(0 < edge ? 0 : 7), true),
+      IndexReader.open(makeEmptyIndex(0), true),
       new MultiReader(new IndexReader[] {
-        IndexReader.open(makeEmptyIndex(0 < edge ? 0 : 5)),
-        IndexReader.open(makeEmptyIndex(0)),
-        0 < edge ? r : IndexReader.open(makeEmptyIndex(0))
+        IndexReader.open(makeEmptyIndex(0 < edge ? 0 : 5), true),
+        IndexReader.open(makeEmptyIndex(0), true),
+        0 < edge ? r : IndexReader.open(makeEmptyIndex(0), true)
       })
     };
     IndexSearcher out = new IndexSearcher(new MultiReader(readers));
@@ -179,18 +179,18 @@
     // we can't put deleted docs before the nested reader, because
     // it will through off the docIds
     Searcher[] searchers = new Searcher[] {
-      edge < 0 ? s : new IndexSearcher(makeEmptyIndex(0)),
+      edge < 0 ? s : new IndexSearcher(makeEmptyIndex(0), true),
       new MultiSearcher(new Searcher[] {
-        new IndexSearcher(makeEmptyIndex(edge < 0 ? 65 : 0)),
-        new IndexSearcher(makeEmptyIndex(0)),
-        0 == edge ? s : new IndexSearcher(makeEmptyIndex(0))
+        new IndexSearcher(makeEmptyIndex(edge < 0 ? 65 : 0), true),
+        new IndexSearcher(makeEmptyIndex(0), true),
+        0 == edge ? s : new IndexSearcher(makeEmptyIndex(0), true)
       }),
-      new IndexSearcher(makeEmptyIndex(0 < edge ? 0 : 3)),
-      new IndexSearcher(makeEmptyIndex(0)),
+      new IndexSearcher(makeEmptyIndex(0 < edge ? 0 : 3), true),
+      new IndexSearcher(makeEmptyIndex(0), true),
       new MultiSearcher(new Searcher[] {
-        new IndexSearcher(makeEmptyIndex(0 < edge ? 0 : 5)),
-        new IndexSearcher(makeEmptyIndex(0)),
-        0 < edge ? s : new IndexSearcher(makeEmptyIndex(0))
+        new IndexSearcher(makeEmptyIndex(0 < edge ? 0 : 5), true),
+        new IndexSearcher(makeEmptyIndex(0), true),
+        0 < edge ? s : new IndexSearcher(makeEmptyIndex(0), true)
       })
     };
     MultiSearcher out = new MultiSearcher(searchers);
@@ -218,7 +218,7 @@
       Assert.assertEquals("writer has non-deleted docs", 
                           0, w.numDocs());
       w.close();
-      IndexReader r = IndexReader.open(d);
+      IndexReader r = IndexReader.open(d, true);
       Assert.assertEquals("reader has wrong number of deleted docs", 
                           numDeletedDocs, r.numDeletedDocs());
       r.close();

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestBoolean2.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestBoolean2.java Sat Oct  3 15:45:34 2009
@@ -48,7 +48,7 @@
       writer.addDocument(doc);
     }
     writer.close();
-    searcher = new IndexSearcher(directory);
+    searcher = new IndexSearcher(directory, true);
   }
 
   private String[] docFields = {

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Sat Oct  3 15:45:34 2009
@@ -74,7 +74,7 @@
         writer.optimize();
         writer.close();
 
-        r = IndexReader.open(index);
+        r = IndexReader.open(index, true);
         s = new IndexSearcher(r);
 
 //System.out.println("Set up " + getName());

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanOr.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanOr.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanOr.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanOr.java Sat Oct  3 15:45:34 2009
@@ -155,6 +155,6 @@
 		writer.close();
 
 		//
-		searcher = new IndexSearcher(rd);
+		searcher = new IndexSearcher(rd, true);
 	}
 }

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java Sat Oct  3 15:45:34 2009
@@ -89,7 +89,7 @@
       }
       writer.close();
       
-      reader = IndexReader.open(directory);
+      reader = IndexReader.open(directory, true);
       PrefixQuery query = new PrefixQuery(new Term("category", "foo"));
       rw1 = query.rewrite(reader);
       

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanScorer.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanScorer.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanScorer.java Sat Oct  3 15:45:34 2009
@@ -64,7 +64,7 @@
       query.add(booleanQuery1, BooleanClause.Occur.MUST);
       query.add(new TermQuery(new Term(FIELD, "9")), BooleanClause.Occur.MUST_NOT);
 
-      IndexSearcher indexSearcher = new IndexSearcher(directory);
+      IndexSearcher indexSearcher = new IndexSearcher(directory, true);
       ScoreDoc[] hits = indexSearcher.search(query, null, 1000).scoreDocs;
       assertEquals("Number of matched documents", 2, hits.length);
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java Sat Oct  3 15:45:34 2009
@@ -36,7 +36,7 @@
     IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
 
     MockFilter filter = new MockFilter();
     CachingWrapperFilter cacher = new CachingWrapperFilter(filter);
@@ -76,7 +76,7 @@
     IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
 
     // not cacheable:
     assertDocIdSetCacheable(reader, new QueryWrapperFilter(new TermQuery(new Term("test","value"))), false);

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestDateFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestDateFilter.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestDateFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestDateFilter.java Sat Oct  3 15:45:34 2009
@@ -62,7 +62,7 @@
  	writer.optimize();
 	writer.close();
 
-	IndexSearcher searcher = new IndexSearcher(indexStore);
+	IndexSearcher searcher = new IndexSearcher(indexStore, true);
 
 	// filter that should preserve matches
 	//DateFilter df1 = DateFilter.Before("datefield", now);
@@ -123,7 +123,7 @@
  	writer.optimize();
 	writer.close();
 
-	IndexSearcher searcher = new IndexSearcher(indexStore);
+	IndexSearcher searcher = new IndexSearcher(indexStore, true);
 
 	// filter that should preserve matches
 	//DateFilter df1 = DateFilter.After("datefield", now);

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestDateSort.java Sat Oct  3 15:45:34 2009
@@ -70,7 +70,7 @@
   }
 
   public void testReverseDateSort() throws Exception {
-    IndexSearcher searcher = new IndexSearcher(directory);
+    IndexSearcher searcher = new IndexSearcher(directory, true);
 
     // Create a Sort object.  reverse is set to true.
     // problem occurs only with SortField.AUTO:

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Sat Oct  3 15:45:34 2009
@@ -121,7 +121,7 @@
 
         writer.close();
 
-        r = IndexReader.open(index);
+        r = IndexReader.open(index, true);
         s = new IndexSearcher(r);
         s.setSimilarity(sim);
     }

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestDocBoost.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestDocBoost.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestDocBoost.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestDocBoost.java Sat Oct  3 15:45:34 2009
@@ -66,7 +66,7 @@
 
     final float[] scores = new float[4];
 
-    new IndexSearcher(store).search
+    new IndexSearcher(store, true).search
       (new TermQuery(new Term("field", "word")),
        new Collector() {
          private int base = 0;

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestExplanations.java Sat Oct  3 15:45:34 2009
@@ -70,7 +70,7 @@
       writer.addDocument(doc);
     }
     writer.close();
-    searcher = new IndexSearcher(directory);
+    searcher = new IndexSearcher(directory, true);
   }
 
   protected String[] docFields = {

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCache.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCache.java Sat Oct  3 15:45:34 2009
@@ -57,7 +57,7 @@
       writer.addDocument(doc);
     }
     writer.close();
-    reader = IndexReader.open(directory);
+    reader = IndexReader.open(directory, true);
   }
 
   public void testInfoStream() throws Exception {

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Sat Oct  3 15:45:34 2009
@@ -49,7 +49,7 @@
 
   public void testRangeFilterId() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     int medId = ((maxId - minId) / 2);
@@ -135,7 +135,7 @@
 
   public void testFieldCacheRangeFilterRand() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     String minRP = pad(signedIndex.minR);
@@ -198,7 +198,7 @@
 
   public void testFieldCacheRangeFilterShorts() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     int numDocs = reader.numDocs();
@@ -289,7 +289,7 @@
   
   public void testFieldCacheRangeFilterInts() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     int numDocs = reader.numDocs();
@@ -381,7 +381,7 @@
   
   public void testFieldCacheRangeFilterLongs() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     int numDocs = reader.numDocs();
@@ -475,7 +475,7 @@
   
   public void testFieldCacheRangeFilterFloats() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     int numDocs = reader.numDocs();
@@ -503,7 +503,7 @@
   
   public void testFieldCacheRangeFilterDoubles() throws IOException {
 
-    IndexReader reader = IndexReader.open(signedIndex.index);
+    IndexReader reader = IndexReader.open(signedIndex.index, true);
     IndexSearcher search = new IndexSearcher(reader);
 
     int numDocs = reader.numDocs();
@@ -545,7 +545,7 @@
     writer.deleteDocuments(new Term("id","0"));
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     IndexSearcher search = new IndexSearcher(reader);
     assertTrue(reader.hasDeletions());
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java Sat Oct  3 15:45:34 2009
@@ -48,7 +48,7 @@
     }
     w.close();
 
-    IndexReader reader = IndexReader.open(rd);
+    IndexReader reader = IndexReader.open(rd, true);
     IndexSearcher searcher = new IndexSearcher(reader);
     int numDocs = reader.numDocs();
     ScoreDoc[] results;

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredSearch.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredSearch.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredSearch.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFilteredSearch.java Sat Oct  3 15:45:34 2009
@@ -61,7 +61,7 @@
       booleanQuery.add(new TermQuery(new Term(FIELD, "36")), BooleanClause.Occur.SHOULD);
      
      
-      IndexSearcher indexSearcher = new IndexSearcher(directory);
+      IndexSearcher indexSearcher = new IndexSearcher(directory, true);
       ScoreDoc[] hits = indexSearcher.search(booleanQuery, filter, 1000).scoreDocs;
       assertEquals("Number of matched documents", 1, hits.length);
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestFuzzyQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestFuzzyQuery.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestFuzzyQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestFuzzyQuery.java Sat Oct  3 15:45:34 2009
@@ -45,7 +45,7 @@
     addDoc("ddddd", writer);
     writer.optimize();
     writer.close();
-    IndexSearcher searcher = new IndexSearcher(directory);
+    IndexSearcher searcher = new IndexSearcher(directory, true);
 
     FuzzyQuery query = new FuzzyQuery(new Term("field", "aaaaa"), FuzzyQuery.defaultMinSimilarity, 0);   
     ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
@@ -168,7 +168,7 @@
     addDoc("segment", writer);
     writer.optimize();
     writer.close();
-    IndexSearcher searcher = new IndexSearcher(directory);
+    IndexSearcher searcher = new IndexSearcher(directory, true);
 
     FuzzyQuery query;
     // not similar enough:
@@ -257,7 +257,7 @@
     addDoc("segment", writer);
     writer.optimize();
     writer.close();
-    IndexSearcher searcher = new IndexSearcher(directory);
+    IndexSearcher searcher = new IndexSearcher(directory, true);
 
     Query query;
     // term not over 10 chars, so optimization shortcuts

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java?rev=821340&r1=821339&r2=821340&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java Sat Oct  3 15:45:34 2009
@@ -48,7 +48,7 @@
     addDoc("three four", iw, 300f);
     iw.close();
 
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, true);
     IndexSearcher is = new IndexSearcher(ir);
     ScoreDoc[] hits;
 



Mime
View raw message