lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r821335 [1/3] - in /lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene: ./ analysis/ document/ index/ queryParser/ search/ search/function/ search/payloads/ search/spans/ store/ util/
Date Sat, 03 Oct 2009 15:04:05 GMT
Author: uschindler
Date: Sat Oct  3 15:04:01 2009
New Revision: 821335

URL: http://svn.apache.org/viewvc?rev=821335&view=rev
Log:
fix deprecated tests #1

Removed:
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestHitIterator.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestCharacterCache.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestTeeTokenFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestTokenStreamBWComp.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestDateTools.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestNumberTools.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexModifier.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/SampleComparable.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSearchHitsWithDeletions.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTimeLimitedCollector.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/payloads/TestBoostingTermQuery.java
Modified:
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearch.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearchForDuplicates.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestBinaryDocument.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestDocument.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAtomicUpdate.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCheckIndex.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCrash.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDeletionPolicy.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDirectoryReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDocumentWriter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFilterIndexReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderClone.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriterReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestLazyBug.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestNorms.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestOmitTf.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestParallelReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestParallelTermEnum.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestPayloads.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentTermEnum.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestStressIndexing.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestStressIndexing2.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestTermVectorsReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestTermdocPerf.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestThreadedOptimize.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestTransactionRollback.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestTransactions.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/queryParser/TestMultiFieldQueryParser.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/queryParser/TestQueryParser.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/QueryUtils.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestBoolean2.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestBooleanOr.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestBooleanPrefixQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestBooleanScorer.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestDateFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestDateSort.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestDocBoost.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestExplanations.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestFieldCache.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestFilteredSearch.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestFuzzyQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestMultiSearcher.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestMultiSearcherRanking.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestNot.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestPhraseQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestPositionIncrement.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestPrefixFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestPrefixQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSetNorm.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSimilarity.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSimpleExplanations.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSort.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestSpanQueryFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestStressSort.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTermRangeFilter.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTermRangeQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTermScorer.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTermVectors.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestThreadSafe.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTopDocsCollector.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/TestWildcard.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/function/TestCustomScoreQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/function/TestFieldScoreQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/function/TestOrdValues.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/payloads/PayloadHelper.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestBasics.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestSpans.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/MockRAMDirectory.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestLockFactory.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestRAMDirectory.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestWindowsMMap.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/util/LuceneTestCase.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearch.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearch.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearch.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearch.java Sat Oct  3 15:04:01 2009
@@ -98,7 +98,7 @@
       }
       writer.close();
 
-      Searcher searcher = new IndexSearcher(directory);
+      Searcher searcher = new IndexSearcher(directory, true);
 
       String[] queries = {
         "a b",

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearchForDuplicates.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearchForDuplicates.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearchForDuplicates.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/TestSearchForDuplicates.java Sat Oct  3 15:04:01 2009
@@ -100,7 +100,7 @@
       writer.close();
 
       // try a search without OR
-      Searcher searcher = new IndexSearcher(directory);
+      Searcher searcher = new IndexSearcher(directory, true);
 
       QueryParser parser = new QueryParser(PRIORITY_FIELD, analyzer);
 
@@ -114,7 +114,7 @@
       searcher.close();
 
       // try a new search with OR
-      searcher = new IndexSearcher(directory);
+      searcher = new IndexSearcher(directory, true);
       hits = null;
 
       parser = new QueryParser(PRIORITY_FIELD, analyzer);

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Sat Oct  3 15:04:01 2009
@@ -32,56 +32,22 @@
  */
 public abstract class BaseTokenStreamTestCase extends LuceneTestCase {
 
-  private boolean onlyUseNewAPI = false;
-  private final Set testWithNewAPI;
-  
   public BaseTokenStreamTestCase() {
     super();
-    this.testWithNewAPI = null; // run all tests also with onlyUseNewAPI
   }
 
   public BaseTokenStreamTestCase(String name) {
     super(name);
-    this.testWithNewAPI = null; // run all tests also with onlyUseNewAPI
   }
 
+  /** @deprecated */
   public BaseTokenStreamTestCase(Set testWithNewAPI) {
     super();
-    this.testWithNewAPI = testWithNewAPI;
   }
 
+  /** @deprecated */
   public BaseTokenStreamTestCase(String name, Set testWithNewAPI) {
     super(name);
-    this.testWithNewAPI = testWithNewAPI;
-  }
-
-  // @Override
-  protected void setUp() throws Exception {
-    super.setUp();
-    TokenStream.setOnlyUseNewAPI(onlyUseNewAPI);
-  }
-
-  // @Override
-  public void runBare() throws Throwable {
-    // Do the test with onlyUseNewAPI=false (default)
-    try {
-      onlyUseNewAPI = false;
-      super.runBare();
-    } catch (Throwable e) {
-      System.out.println("Test failure of '"+getName()+"' occurred with onlyUseNewAPI=false");
-      throw e;
-    }
-
-    if (testWithNewAPI == null || testWithNewAPI.contains(getName())) {
-      // Do the test again with onlyUseNewAPI=true
-      try {
-        onlyUseNewAPI = true;
-        super.runBare();
-      } catch (Throwable e) {
-        System.out.println("Test failure of '"+getName()+"' occurred with onlyUseNewAPI=true");
-        throw e;
-      }
-    }
   }
   
   // some helpers to test Analyzers and TokenStreams:

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestCachingTokenFilter.java Sat Oct  3 15:04:01 2009
@@ -70,7 +70,7 @@
     writer.addDocument(doc);
     writer.close();
     
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     TermPositions termPositions = reader.termPositions(new Term("preanalyzed", "term1"));
     assertTrue(termPositions.next());
     assertEquals(1, termPositions.freq());

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/analysis/TestKeywordAnalyzer.java Sat Oct  3 15:04:01 2009
@@ -51,7 +51,7 @@
 
     writer.close();
 
-    searcher = new IndexSearcher(directory);
+    searcher = new IndexSearcher(directory, true);
   }
 
   public void testPerFieldAnalyzer() throws Exception {
@@ -78,7 +78,7 @@
     writer.addDocument(doc);
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     TermDocs td = reader.termDocs(new Term("partnum", "Q36"));
     assertTrue(td.next());
     td = reader.termDocs(new Term("partnum", "Q37"));

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestBinaryDocument.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestBinaryDocument.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestBinaryDocument.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestBinaryDocument.java Sat Oct  3 15:04:01 2009
@@ -71,7 +71,7 @@
     writer.close();
     
     /** open a reader and fetch the document */ 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     Document docFromReader = reader.document(0);
     assertTrue(docFromReader != null);
     
@@ -117,7 +117,7 @@
     writer.close();
     
     /** open a reader and fetch the document */ 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     Document docFromReader = reader.document(0);
     assertTrue(docFromReader != null);
     

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestDocument.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestDocument.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestDocument.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/document/TestDocument.java Sat Oct  3 15:04:01 2009
@@ -161,7 +161,7 @@
         writer.addDocument(makeDocumentWithFields());
         writer.close();
 
-        Searcher searcher = new IndexSearcher(dir);
+        Searcher searcher = new IndexSearcher(dir, true);
 
 	// search for something that does exists
 	Query query = new TermQuery(new Term("keyword", "test1"));
@@ -236,7 +236,7 @@
       writer.addDocument(doc);
       writer.close();
 
-      Searcher searcher = new IndexSearcher(dir);
+      Searcher searcher = new IndexSearcher(dir, true);
 
       Query query = new TermQuery(new Term("keyword", "test"));
 

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAddIndexesNoOptimize.java Sat Oct  3 15:04:01 2009
@@ -358,7 +358,7 @@
 
     setUpDirs(dir, aux);
 
-    IndexReader reader = IndexReader.open(aux);
+    IndexReader reader = IndexReader.open(aux, false);
     for (int i = 0; i < 20; i++) {
       reader.deleteDocument(i);
     }
@@ -396,14 +396,14 @@
     assertEquals(3, writer.getSegmentCount());
     writer.close();
 
-    IndexReader reader = IndexReader.open(aux);
+    IndexReader reader = IndexReader.open(aux, false);
     for (int i = 0; i < 27; i++) {
       reader.deleteDocument(i);
     }
     assertEquals(3, reader.numDocs());
     reader.close();
 
-    reader = IndexReader.open(aux2);
+    reader = IndexReader.open(aux2, false);
     for (int i = 0; i < 8; i++) {
       reader.deleteDocument(i);
     }
@@ -449,7 +449,7 @@
   }
 
   private void verifyNumDocs(Directory dir, int numDocs) throws IOException {
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     assertEquals(numDocs, reader.maxDoc());
     assertEquals(numDocs, reader.numDocs());
     reader.close();
@@ -457,7 +457,7 @@
 
   private void verifyTermDocs(Directory dir, Term term, int numDocs)
       throws IOException {
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     TermDocs termDocs = reader.termDocs(term);
     int count = 0;
     while (termDocs.next())

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAtomicUpdate.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAtomicUpdate.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAtomicUpdate.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestAtomicUpdate.java Sat Oct  3 15:04:01 2009
@@ -111,7 +111,7 @@
     }
 
     public void doWork() throws Throwable {
-      IndexReader r = IndexReader.open(directory);
+      IndexReader r = IndexReader.open(directory, true);
       assertEquals(100, r.numDocs());
       r.close();
     }
@@ -138,7 +138,7 @@
     }
     writer.commit();
 
-    IndexReader r = IndexReader.open(directory);
+    IndexReader r = IndexReader.open(directory, true);
     assertEquals(100, r.numDocs());
     r.close();
 

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCheckIndex.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCheckIndex.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCheckIndex.java Sat Oct  3 15:04:01 2009
@@ -43,7 +43,7 @@
       writer.addDocument(doc);
     }
     writer.close();
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     reader.deleteDocument(5);
     reader.close();
 

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java Sat Oct  3 15:04:01 2009
@@ -88,7 +88,7 @@
     }
 
     writer.close();
-    IndexReader reader = IndexReader.open(directory);
+    IndexReader reader = IndexReader.open(directory, true);
     assertEquals(200, reader.numDocs());
     reader.close();
     directory.close();
@@ -131,7 +131,7 @@
     }
 
     writer.close();
-    IndexReader reader = IndexReader.open(directory);
+    IndexReader reader = IndexReader.open(directory, true);
     // Verify that we did not lose any deletes...
     assertEquals(450, reader.numDocs());
     reader.close();
@@ -207,7 +207,7 @@
 
         writer.close(false);
 
-        IndexReader reader = IndexReader.open(directory);
+        IndexReader reader = IndexReader.open(directory, true);
         assertEquals((1+iter)*182, reader.numDocs());
         reader.close();
 

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCrash.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCrash.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCrash.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestCrash.java Sat Oct  3 15:04:01 2009
@@ -61,7 +61,7 @@
     IndexWriter writer = initIndex();
     MockRAMDirectory dir = (MockRAMDirectory) writer.getDirectory();
     crash(writer);
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     assertTrue(reader.numDocs() < 157);
   }
 
@@ -73,7 +73,7 @@
     writer = initIndex(dir);
     writer.close();
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     assertTrue(reader.numDocs() < 314);
   }
 
@@ -94,7 +94,7 @@
     dir.fileLength(l[i]) + " bytes");
     */
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     assertTrue(reader.numDocs() >= 157);
   }
 
@@ -113,7 +113,7 @@
       System.out.println("file " + i + " = " + l[i] + " " + dir.fileLength(l[i]) + " bytes");
     */
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     assertEquals(157, reader.numDocs());
   }
 
@@ -132,7 +132,7 @@
     for(int i=0;i<l.length;i++)
       System.out.println("file " + i + " = " + l[i] + " " + dir.fileLength(l[i]) + " bytes");
     */
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     assertEquals(157, reader.numDocs());
   }
 
@@ -142,7 +142,7 @@
     MockRAMDirectory dir = (MockRAMDirectory) writer.getDirectory();
 
     writer.close(false);
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     reader.deleteDocument(3);
 
     dir.crash();
@@ -153,7 +153,7 @@
     for(int i=0;i<l.length;i++)
       System.out.println("file " + i + " = " + l[i] + " " + dir.fileLength(l[i]) + " bytes");
     */
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, false);
     assertEquals(157, reader.numDocs());
   }
 
@@ -163,7 +163,7 @@
     MockRAMDirectory dir = (MockRAMDirectory) writer.getDirectory();
 
     writer.close(false);
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     reader.deleteDocument(3);
     reader.close();
 
@@ -175,7 +175,7 @@
     for(int i=0;i<l.length;i++)
       System.out.println("file " + i + " = " + l[i] + " " + dir.fileLength(l[i]) + " bytes");
     */
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, false);
     assertEquals(156, reader.numDocs());
   }
 }

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDeletionPolicy.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDeletionPolicy.java Sat Oct  3 15:04:01 2009
@@ -74,7 +74,7 @@
     }
     public void onCommit(List commits) throws IOException {
       IndexCommit lastCommit = (IndexCommit) commits.get(commits.size()-1);
-      IndexReader r = IndexReader.open(dir);
+      IndexReader r = IndexReader.open(dir, true);
       assertEquals("lastCommit.isOptimized()=" + lastCommit.isOptimized() + " vs IndexReader.isOptimized=" + r.isOptimized(), r.isOptimized(), lastCommit.isOptimized());
       r.close();
       verifyCommitOrder(commits);
@@ -243,7 +243,7 @@
     dir.deleteFile(IndexFileNames.SEGMENTS_GEN);
     while(gen > 0) {
       try {
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
         reader.close();
         fileName = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS,
                                                          "",
@@ -314,7 +314,7 @@
       // Make sure we can open a reader on each commit:
       while(it.hasNext()) {
         IndexCommit commit = (IndexCommit) it.next();
-        IndexReader r = IndexReader.open(commit, null);
+        IndexReader r = IndexReader.open(commit, null, false);
         r.close();
       }
 
@@ -323,7 +323,7 @@
       dir.deleteFile(IndexFileNames.SEGMENTS_GEN);
       long gen = SegmentInfos.getCurrentSegmentGeneration(dir);
       while(gen > 0) {
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, true);
         reader.close();
         dir.deleteFile(IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS, "", gen));
         gen--;
@@ -392,7 +392,7 @@
     // Should undo our rollback:
     writer.rollback();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, true);
     // Still optimized, still 11 docs
     assertTrue(r.isOptimized());
     assertEquals(11, r.numDocs());
@@ -406,7 +406,7 @@
     // Now 8 because we made another commit
     assertEquals(8, IndexReader.listCommits(dir).size());
     
-    r = IndexReader.open(dir);
+    r = IndexReader.open(dir, true);
     // Not optimized because we rolled it back, and now only
     // 10 docs
     assertTrue(!r.isOptimized());
@@ -418,7 +418,7 @@
     writer.optimize();
     writer.close();
 
-    r = IndexReader.open(dir);
+    r = IndexReader.open(dir, true);
     assertTrue(r.isOptimized());
     assertEquals(10, r.numDocs());
     r.close();
@@ -430,7 +430,7 @@
     
     // Reader still sees optimized index, because writer
     // opened on the prior commit has not yet committed:
-    r = IndexReader.open(dir);
+    r = IndexReader.open(dir, true);
     assertTrue(r.isOptimized());
     assertEquals(10, r.numDocs());
     r.close();
@@ -438,7 +438,7 @@
     writer.close();
 
     // Now reader sees unoptimized index:
-    r = IndexReader.open(dir);
+    r = IndexReader.open(dir, true);
     assertTrue(!r.isOptimized());
     assertEquals(10, r.numDocs());
     r.close();
@@ -483,7 +483,7 @@
 
       // Simplistic check: just verify the index is in fact
       // readable:
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
       reader.close();
 
       dir.close();
@@ -531,7 +531,7 @@
       long gen = SegmentInfos.getCurrentSegmentGeneration(dir);
       for(int i=0;i<N+1;i++) {
         try {
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, true);
           reader.close();
           if (i == N) {
             fail("should have failed on commits prior to last " + N);
@@ -581,7 +581,7 @@
         }
         // this is a commit when autoCommit=false:
         writer.close();
-        IndexReader reader = IndexReader.open(dir, policy);
+        IndexReader reader = IndexReader.open(dir, policy, false);
         reader.deleteDocument(3*i+1);
         reader.setNorm(4*i+1, "content", 2.0F);
         IndexSearcher searcher = new IndexSearcher(reader);
@@ -601,7 +601,7 @@
       if (!autoCommit)
         assertEquals(2*(N+2)-1, policy.numOnCommit);
 
-      IndexSearcher searcher = new IndexSearcher(dir);
+      IndexSearcher searcher = new IndexSearcher(dir, false);
       ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
       assertEquals(176, hits.length);
 
@@ -614,7 +614,7 @@
 
       for(int i=0;i<N+1;i++) {
         try {
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, true);
 
           // Work backwards in commits on what the expected
           // count should be.  Only check this in the
@@ -684,7 +684,7 @@
         }
         // this is a commit when autoCommit=false:
         writer.close();
-        IndexReader reader = IndexReader.open(dir, policy);
+        IndexReader reader = IndexReader.open(dir, policy, false);
         reader.deleteDocument(3);
         reader.setNorm(5, "content", 2.0F);
         IndexSearcher searcher = new IndexSearcher(reader);
@@ -704,7 +704,7 @@
       if (!autoCommit)
         assertEquals(3*(N+1), policy.numOnCommit);
 
-      IndexSearcher searcher = new IndexSearcher(dir);
+      IndexSearcher searcher = new IndexSearcher(dir, false);
       ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
       assertEquals(0, hits.length);
 
@@ -717,7 +717,7 @@
 
       for(int i=0;i<N+1;i++) {
         try {
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, true);
 
           // Work backwards in commits on what the expected
           // count should be.  Only check this in the

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDirectoryReader.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDirectoryReader.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDirectoryReader.java Sat Oct  3 15:04:01 2009
@@ -54,7 +54,7 @@
 
   protected IndexReader openReader() throws IOException {
     IndexReader reader;
-    reader = IndexReader.open(dir);
+    reader = IndexReader.open(dir, false);
     assertTrue(reader instanceof DirectoryReader);
 
     assertTrue(dir != null);
@@ -133,7 +133,7 @@
     addDoc(ramDir1, "test foo", true);
     RAMDirectory ramDir2=new RAMDirectory();
     addDoc(ramDir2, "test blah", true);
-    IndexReader[] readers = new IndexReader[]{IndexReader.open(ramDir1), IndexReader.open(ramDir2)};
+    IndexReader[] readers = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir2, false)};
     MultiReader mr = new MultiReader(readers);
     assertTrue(mr.isCurrent());   // just opened, must be current
     addDoc(ramDir1, "more text", false);
@@ -157,8 +157,8 @@
     RAMDirectory ramDir3=new RAMDirectory();
     addDoc(ramDir3, "test wow", true);
 
-    IndexReader[] readers1 = new IndexReader[]{IndexReader.open(ramDir1), IndexReader.open(ramDir3)};
-    IndexReader[] readers2 = new IndexReader[]{IndexReader.open(ramDir1), IndexReader.open(ramDir2), IndexReader.open(ramDir3)};
+    IndexReader[] readers1 = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir3, false)};
+    IndexReader[] readers2 = new IndexReader[]{IndexReader.open(ramDir1, false), IndexReader.open(ramDir2, false), IndexReader.open(ramDir3, false)};
     MultiReader mr2 = new MultiReader(readers1);
     MultiReader mr3 = new MultiReader(readers2);
 

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDocumentWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDocumentWriter.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDocumentWriter.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestDocumentWriter.java Sat Oct  3 15:04:01 2009
@@ -265,7 +265,7 @@
 
     _TestUtil.checkIndex(dir);
 
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, true);
     // f1
     TermFreqVector tfv1 = reader.getTermFreqVector(0, "f1");
     assertNotNull(tfv1);

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java Sat Oct  3 15:04:01 2009
@@ -398,7 +398,7 @@
       writer.optimize();
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, true);
 
       FaultyIndexInput.doFail = true;
 

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFilterIndexReader.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFilterIndexReader.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFilterIndexReader.java Sat Oct  3 15:04:01 2009
@@ -110,7 +110,7 @@
 
     writer.close();
 
-    IndexReader reader = new TestReader(IndexReader.open(directory));
+    IndexReader reader = new TestReader(IndexReader.open(directory, true));
 
     assertTrue(reader.isOptimized());
     

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexFileDeleter.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexFileDeleter.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexFileDeleter.java Sat Oct  3 15:04:01 2009
@@ -54,7 +54,7 @@
     writer.close();
 
     // Delete one doc so we get a .del file:
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     Term searchTerm = new Term("id", "7");
     int delCount = reader.deleteDocuments(searchTerm);
     assertEquals("didn't delete the right number of documents", 1, delCount);

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReader.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReader.java Sat Oct  3 15:04:01 2009
@@ -82,14 +82,14 @@
         addDocumentWithFields(writer);
       writer.close();
       
-      IndexReader r = IndexReader.open(d);
+      IndexReader r = IndexReader.open(d, false);
       r.deleteDocument(5);
       r.flush(commitUserData);
       r.close();
       
       SegmentInfos sis = new SegmentInfos();
       sis.read(d);
-      IndexReader r2 = IndexReader.open(d);
+      IndexReader r2 = IndexReader.open(d, false);
       IndexCommit c = r.getIndexCommit();
       assertEquals(c.getUserData(), commitUserData);
 
@@ -127,7 +127,7 @@
       addDocumentWithFields(writer);
       writer.close();
       // set up reader:
-      IndexReader reader = IndexReader.open(d);
+      IndexReader reader = IndexReader.open(d, false);
       assertTrue(reader.isCurrent());
       // modify index by adding another document:
       writer = new IndexWriter(d, new StandardAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
@@ -155,7 +155,7 @@
         addDocumentWithFields(writer);
         writer.close();
         // set up reader
-        IndexReader reader = IndexReader.open(d);
+        IndexReader reader = IndexReader.open(d, false);
         Collection fieldNames = reader.getFieldNames(IndexReader.FieldOption.ALL);
         assertTrue(fieldNames.contains("keyword"));
         assertTrue(fieldNames.contains("text"));
@@ -182,7 +182,7 @@
         
         writer.close();
         // verify fields again
-        reader = IndexReader.open(d);
+        reader = IndexReader.open(d, false);
         fieldNames = reader.getFieldNames(IndexReader.FieldOption.ALL);
         assertEquals(13, fieldNames.size());    // the following fields
         assertTrue(fieldNames.contains("keyword"));
@@ -257,7 +257,7 @@
         writer.addDocument(doc);
     }
     writer.close();
-    IndexReader reader = IndexReader.open(d);
+    IndexReader reader = IndexReader.open(d, false);
     FieldSortedTermVectorMapper mapper = new FieldSortedTermVectorMapper(new TermVectorEntryFreqSortedComparator());
     reader.getTermFreqVector(0, mapper);
     Map map = mapper.getFieldToTerms();
@@ -320,14 +320,14 @@
 
         // OPEN READER AT THIS POINT - this should fix the view of the
         // index at the point of having 100 "aaa" documents and 0 "bbb"
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
         assertTermDocsCount("first reader", reader, searchTerm, 100);
         reader.close();
 
         // DELETE DOCUMENTS CONTAINING TERM: aaa
         int deleted = 0;
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         deleted = reader.deleteDocuments(searchTerm);
         assertEquals("deleted count", 100, deleted);
         assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
@@ -336,11 +336,11 @@
         // open a 2nd reader to make sure first reader can
         // commit its changes (.del) while second reader
         // is open:
-        IndexReader reader2 = IndexReader.open(dir);
+        IndexReader reader2 = IndexReader.open(dir, false);
         reader.close();
 
         // CREATE A NEW READER and re-test
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
         assertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
         reader.close();
@@ -369,7 +369,7 @@
         doc.add(new Field("junk", "junk text", Field.Store.NO, Field.Index.ANALYZED));
         writer.addDocument(doc);
         writer.close();
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, false);
         doc = reader.document(reader.maxDoc() - 1);
         Field[] fields = doc.getFields("bin1");
         assertNotNull(fields);
@@ -413,7 +413,7 @@
         writer = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
         writer.optimize();
         writer.close();
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         doc = reader.document(reader.maxDoc() - 1);
         fields = doc.getFields("bin1");
         assertNotNull(fields);
@@ -456,7 +456,7 @@
         }
         writer.close();
 
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
 
         // Close reader:
         reader.close();
@@ -501,7 +501,7 @@
         }
 
         // Create reader:
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
 
         // Try to make changes
         try {
@@ -548,7 +548,7 @@
         writer.close();
 
         //  now open reader & set norm for doc 0
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         reader.setNorm(0, "content", (float) 2.0);
 
         // we should be holding the write lock now:
@@ -560,7 +560,7 @@
         assertTrue("not locked", !IndexReader.isLocked(dir));
 
         // open a 2nd reader:
-        IndexReader reader2 = IndexReader.open(dir);
+        IndexReader reader2 = IndexReader.open(dir, false);
 
         // set norm again for doc 0
         reader.setNorm(0, "content", (float) 3.0);
@@ -595,12 +595,12 @@
 
         //  now open reader & set norm for doc 0 (writes to
         //  _0_1.s0)
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         reader.setNorm(0, "content", (float) 2.0);
         reader.close();
         
         //  now open reader again & set norm for doc 0 (writes to _0_2.s0)
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         reader.setNorm(0, "content", (float) 2.0);
         reader.close();
         assertFalse("failed to remove first generation norms file on writing second generation",
@@ -614,7 +614,7 @@
       deleteReaderWriterConflict(false);
     }
 
-    public void testOpenEmptyDirectory() throws IOException{
+    /* ??? public void testOpenEmptyDirectory() throws IOException{
       String dirName = "test.empty";
       File fileDirName = new File(dirName);
       if (!fileDirName.exists()) {
@@ -627,7 +627,7 @@
         // GOOD
       }
       rmDir(fileDirName);
-    }
+    }*/
     
     public void testDeleteReaderWriterConflictOptimized() throws IOException{
         deleteReaderWriterConflict(true);
@@ -651,7 +651,7 @@
 
         // OPEN READER AT THIS POINT - this should fix the view of the
         // index at the point of having 100 "aaa" documents and 0 "bbb"
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, false);
         assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
         assertEquals("first docFreq", 0, reader.docFreq(searchTerm2));
         assertTermDocsCount("first reader", reader, searchTerm, 100);
@@ -693,7 +693,7 @@
         // Re-open index reader and try again. This time it should see
         // the new data.
         reader.close();
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         assertEquals("first docFreq", 100, reader.docFreq(searchTerm));
         assertEquals("first docFreq", 100, reader.docFreq(searchTerm2));
         assertTermDocsCount("first reader", reader, searchTerm, 100);
@@ -708,7 +708,7 @@
         reader.close();
 
         // CREATE A NEW READER and re-test
-        reader = IndexReader.open(dir);
+        reader = IndexReader.open(dir, false);
         assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm));
         assertEquals("deleted docFreq", 100, reader.docFreq(searchTerm2));
         assertTermDocsCount("deleted termDocs", reader, searchTerm, 0);
@@ -742,7 +742,7 @@
 
         // Now open existing directory and test that reader closes all files
         dir = getDirectory();
-        IndexReader reader1 = IndexReader.open(dir);
+        IndexReader reader1 = IndexReader.open(dir, false);
         reader1.close();
         dir.close();
 
@@ -767,7 +767,7 @@
           assertTrue(IndexReader.isLocked(dir));		// writer open, so dir is locked
           writer.close();
           assertTrue(IndexReader.indexExists(dir));
-          IndexReader reader = IndexReader.open(dir);
+          IndexReader reader = IndexReader.open(dir, false);
           assertFalse(IndexReader.isLocked(dir));		// reader only, no lock
           long version = IndexReader.lastModified(dir);
           if (i == 1) {
@@ -782,7 +782,7 @@
           writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
           addDocumentWithFields(writer);
           writer.close();
-          reader = IndexReader.open(dir);
+          reader = IndexReader.open(dir, false);
           assertTrue("old lastModified is " + version + "; new lastModified is " + IndexReader.lastModified(dir), version <= IndexReader.lastModified(dir));
           reader.close();
           dir.close();
@@ -802,7 +802,7 @@
       assertTrue(IndexReader.isLocked(dir));		// writer open, so dir is locked
       writer.close();
       assertTrue(IndexReader.indexExists(dir));
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       assertFalse(IndexReader.isLocked(dir));		// reader only, no lock
       long version = IndexReader.getCurrentVersion(dir);
       reader.close();
@@ -811,7 +811,7 @@
       writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
       addDocumentWithFields(writer);
       writer.close();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, false);
       assertTrue("old version is " + version + "; new version is " + IndexReader.getCurrentVersion(dir), version < IndexReader.getCurrentVersion(dir));
       reader.close();
       dir.close();
@@ -823,7 +823,7 @@
       addDocumentWithFields(writer);
       writer.close();
       writer  = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       try {
         reader.deleteDocument(0);
         fail("expected lock");
@@ -843,12 +843,12 @@
       addDocumentWithFields(writer);
       addDocumentWithFields(writer);
       writer.close();
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       reader.deleteDocument(0);
       reader.deleteDocument(1);
       reader.undeleteAll();
       reader.close();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, false);
       assertEquals(2, reader.numDocs());	// nothing has really been deleted thanks to undeleteAll()
       reader.close();
       dir.close();
@@ -860,11 +860,11 @@
       addDocumentWithFields(writer);
       addDocumentWithFields(writer);
       writer.close();
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       reader.deleteDocument(0);
       reader.deleteDocument(1);
       reader.close();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, false);
       reader.undeleteAll();
       assertEquals(2, reader.numDocs());	// nothing has really been deleted thanks to undeleteAll()
       reader.close();
@@ -877,14 +877,14 @@
       addDocumentWithFields(writer);
       addDocumentWithFields(writer);
       writer.close();
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       reader.deleteDocument(0);
       reader.deleteDocument(1);
       reader.close();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, false);
       reader.undeleteAll();
       reader.close();
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, false);
       assertEquals(2, reader.numDocs());	// nothing has really been deleted thanks to undeleteAll()
       reader.close();
       dir.close();
@@ -935,7 +935,7 @@
         // the same files again.
         dir.setPreventDoubleWrite(false);
 
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, false);
 
         // For each disk size, first try to commit against
         // dir that will hit random IOExceptions & disk
@@ -1039,7 +1039,7 @@
           // changed (transactional semantics):
           IndexReader newReader = null;
           try {
-            newReader = IndexReader.open(dir);
+            newReader = IndexReader.open(dir, false);
           } catch (IOException e) {
             e.printStackTrace();
             fail(testName + ":exception when creating IndexReader after disk full during close: " + e);
@@ -1106,7 +1106,7 @@
         addDoc(writer, "aaa");
       }
       writer.close();
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
 
       // Try to delete an invalid docId, yet, within range
       // of the final bits of the BitVector:
@@ -1145,7 +1145,7 @@
       addDoc(writer, "aaa");
       writer.close();
 
-      IndexReader reader = IndexReader.open(dir);
+      IndexReader reader = IndexReader.open(dir, false);
       try {
         reader.deleteDocument(1);
         fail("did not hit exception when deleting an invalid doc number");
@@ -1157,7 +1157,7 @@
         fail("write lock is still held after close");
       }
 
-      reader = IndexReader.open(dir);
+      reader = IndexReader.open(dir, false);
       try {
         reader.setNorm(1, "content", (float) 2.0);
         fail("did not hit exception when calling setNorm on an invalid doc number");
@@ -1187,7 +1187,7 @@
                           "deletetest");
       Directory dir = FSDirectory.open(dirFile);
       try {
-        IndexReader.open(dir);
+        IndexReader.open(dir, false);
         fail("expected FileNotFoundException");
       } catch (FileNotFoundException e) {
         // expected
@@ -1197,7 +1197,7 @@
 
       // Make sure we still get a CorruptIndexException (not NPE):
       try {
-        IndexReader.open(dir);
+        IndexReader.open(dir, false);
         fail("expected FileNotFoundException");
       } catch (FileNotFoundException e) {
         // expected
@@ -1230,7 +1230,7 @@
 
         // OPEN TWO READERS
         // Both readers get segment info as exists at this time
-        IndexReader reader1 = IndexReader.open(dir);
+        IndexReader reader1 = IndexReader.open(dir, false);
         assertEquals("first opened", 100, reader1.docFreq(searchTerm1));
         assertEquals("first opened", 100, reader1.docFreq(searchTerm2));
         assertEquals("first opened", 100, reader1.docFreq(searchTerm3));
@@ -1238,7 +1238,7 @@
         assertTermDocsCount("first opened", reader1, searchTerm2, 100);
         assertTermDocsCount("first opened", reader1, searchTerm3, 100);
 
-        IndexReader reader2 = IndexReader.open(dir);
+        IndexReader reader2 = IndexReader.open(dir, false);
         assertEquals("first opened", 100, reader2.docFreq(searchTerm1));
         assertEquals("first opened", 100, reader2.docFreq(searchTerm2));
         assertEquals("first opened", 100, reader2.docFreq(searchTerm3));
@@ -1279,7 +1279,7 @@
 
         // RECREATE READER AND TRY AGAIN
         reader1.close();
-        reader1 = IndexReader.open(dir);
+        reader1 = IndexReader.open(dir, false);
         assertEquals("reopened", 100, reader1.docFreq(searchTerm1));
         assertEquals("reopened", 100, reader1.docFreq(searchTerm2));
         assertEquals("reopened", 100, reader1.docFreq(searchTerm3));
@@ -1297,7 +1297,7 @@
         reader1.close();
 
         // Open another reader to confirm that everything is deleted
-        reader2 = IndexReader.open(dir);
+        reader2 = IndexReader.open(dir, false);
         assertEquals("reopened 2", 100, reader2.docFreq(searchTerm1));
         assertEquals("reopened 2", 100, reader2.docFreq(searchTerm2));
         assertEquals("reopened 2", 100, reader2.docFreq(searchTerm3));
@@ -1449,7 +1449,7 @@
 
       SegmentInfos sis = new SegmentInfos();
       sis.read(d);
-      IndexReader r = IndexReader.open(d);
+      IndexReader r = IndexReader.open(d, false);
       IndexCommit c = r.getIndexCommit();
 
       assertEquals(sis.getCurrentSegmentFileName(), c.getSegmentsFileName());
@@ -1537,42 +1537,6 @@
       r3.close();
     }
 
-    public void testFalseDirectoryAlreadyClosed() throws Throwable {
-
-      File indexDir = _TestUtil.getTempDir("lucenetestdiralreadyclosed");
-
-      try {
-        FSDirectory dir = FSDirectory.getDirectory(indexDir);
-        IndexWriter w = new IndexWriter(indexDir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
-        w.setUseCompoundFile(false);
-        Document doc = new Document();
-        w.addDocument(doc);
-        w.close();
-        assertTrue(new File(indexDir, "_0.fnm").delete());
-
-        try {
-          IndexReader.open(indexDir);
-          fail("did not hit expected exception");
-        } catch (AlreadyClosedException ace) {
-          fail("should not have hit AlreadyClosedException");
-        } catch (FileNotFoundException ioe) {
-          // expected
-        }
-
-        // Make sure we really did close the dir inside IndexReader.open
-        dir.close();
-
-        try {
-          dir.fileExists("hi");
-          fail("did not hit expected exception");
-        } catch (AlreadyClosedException ace) {
-          // expected
-        }
-      } finally {
-        _TestUtil.rmDir(indexDir);
-      }
-    }
-
 
   // LUCENE-1474
   public void testIndexReader() throws Exception {
@@ -1583,12 +1547,12 @@
     writer.addDocument(createDocument("b"));
     writer.addDocument(createDocument("c"));
     writer.close();
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     reader.deleteDocuments(new Term("id", "a"));
     reader.flush();
     reader.deleteDocuments(new Term("id", "b"));
     reader.close();
-    IndexReader.open(dir).close();
+    IndexReader.open(dir,true).close();
   }
 
   // LUCENE-1647
@@ -1601,14 +1565,14 @@
     writer.addDocument(createDocument("b"));
     writer.addDocument(createDocument("c"));
     writer.close();
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     reader.deleteDocuments(new Term("id", "a"));
     reader.flush();
     reader.deleteDocuments(new Term("id", "b"));
     reader.undeleteAll();
     reader.deleteDocuments(new Term("id", "b"));
     reader.close();
-    IndexReader.open(dir).close();
+    IndexReader.open(dir,true).close();
     dir.close();
   }
 
@@ -1624,7 +1588,7 @@
   public void testNoDir() throws Throwable {
     Directory dir = FSDirectory.open(_TestUtil.getTempDir("doesnotexist"));
     try {
-      IndexReader.open(dir);
+      IndexReader.open(dir, true);
       fail("did not hit expected exception");
     } catch (NoSuchDirectoryException nsde) {
       // expected
@@ -1705,7 +1669,7 @@
     writer.commit();
 
     // Open reader1
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, false);
     IndexReader r1 = SegmentReader.getOnlySegmentReader(r);
     final int[] ints = FieldCache.DEFAULT.getInts(r1, "number");
     assertEquals(1, ints.length);
@@ -1737,7 +1701,7 @@
     writer.commit();
 
     // Open reader1
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, false);
     assertTrue(r instanceof DirectoryReader);
     IndexReader r1 = SegmentReader.getOnlySegmentReader(r);
     final int[] ints = FieldCache.DEFAULT.getInts(r1, "number");
@@ -1779,7 +1743,7 @@
     writer.addDocument(doc);
     writer.commit();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, false);
     IndexReader r1 = SegmentReader.getOnlySegmentReader(r);
     assertEquals(36, r1.getUniqueTermCount());
     writer.addDocument(doc);

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderClone.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderClone.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderClone.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderClone.java Sat Oct  3 15:04:01 2009
@@ -43,7 +43,7 @@
     final Directory dir1 = new MockRAMDirectory();
 
     TestIndexReaderReopen.createIndex(dir1, false);
-    IndexReader reader = IndexReader.open(dir1);
+    IndexReader reader = IndexReader.open(dir1, false);
     IndexReader readOnlyReader = reader.clone(true);
     if (!isReadOnly(readOnlyReader)) {
       fail("reader isn't read only");
@@ -56,34 +56,6 @@
     dir1.close();
   }
 
-  // LUCENE-1453
-  public void testFSDirectoryClone() throws Exception {
-
-    String tempDir = System.getProperty("java.io.tmpdir");
-    if (tempDir == null)
-      throw new IOException("java.io.tmpdir undefined, cannot run test");
-    File indexDir2 = new File(tempDir, "FSDirIndexReaderClone");
-
-    Directory dir1 = FSDirectory.getDirectory(indexDir2);
-    TestIndexReaderReopen.createIndex(dir1, false);
-
-    IndexReader reader = IndexReader.open(indexDir2);
-    IndexReader readOnlyReader = (IndexReader) reader.clone();
-    reader.close();
-    readOnlyReader.close();
-
-    // Make sure we didn't pick up too many incRef's along
-    // the way -- this close should be the final close:
-    dir1.close();
-
-    try {
-      dir1.listAll();
-      fail("did not hit AlreadyClosedException");
-    } catch (AlreadyClosedException ace) {
-      // expected
-    }
-  }
-
   // open non-readOnly reader1, clone to non-readOnly
   // reader2, make sure we can change reader2
   public void testCloneNoChangesStillReadOnly() throws Exception {
@@ -255,7 +227,7 @@
     final Directory dir1 = new MockRAMDirectory();
 
     TestIndexReaderReopen.createIndex(dir1, true);
-    IndexReader reader = IndexReader.open(dir1);
+    IndexReader reader = IndexReader.open(dir1, false);
     IndexReader readOnlyReader = reader.clone(true);
     if (!isReadOnly(readOnlyReader)) {
       fail("reader isn't read only");
@@ -277,8 +249,8 @@
     TestIndexReaderReopen.createIndex(dir1, true);
     final Directory dir2 = new MockRAMDirectory();
     TestIndexReaderReopen.createIndex(dir2, true);
-    IndexReader r1 = IndexReader.open(dir1);
-    IndexReader r2 = IndexReader.open(dir2);
+    IndexReader r1 = IndexReader.open(dir1, false);
+    IndexReader r2 = IndexReader.open(dir2, false);
 
     ParallelReader pr1 = new ParallelReader();
     pr1.add(r1);
@@ -327,8 +299,8 @@
     TestIndexReaderReopen.createIndex(dir1, true);
     final Directory dir2 = new MockRAMDirectory();
     TestIndexReaderReopen.createIndex(dir2, true);
-    IndexReader r1 = IndexReader.open(dir1);
-    IndexReader r2 = IndexReader.open(dir2);
+    IndexReader r1 = IndexReader.open(dir1, false);
+    IndexReader r2 = IndexReader.open(dir2, false);
 
     MultiReader multiReader = new MultiReader(new IndexReader[] { r1, r2 });
     performDefaultTests(multiReader);
@@ -373,7 +345,7 @@
     final Directory dir1 = new MockRAMDirectory();
     TestIndexReaderReopen.createIndex(dir1, false);
 
-    IndexReader origReader = IndexReader.open(dir1);
+    IndexReader origReader = IndexReader.open(dir1, false);
     SegmentReader origSegmentReader = SegmentReader.getOnlySegmentReader(origReader);
     // deletedDocsRef should be null because nothing has updated yet
     assertNull(origSegmentReader.deletedDocsRef);
@@ -435,14 +407,14 @@
   public void testCloneWithDeletes() throws Throwable {
     final Directory dir1 = new MockRAMDirectory();
     TestIndexReaderReopen.createIndex(dir1, false);
-    IndexReader origReader = IndexReader.open(dir1);
+    IndexReader origReader = IndexReader.open(dir1, false);
     origReader.deleteDocument(1);
 
     IndexReader clonedReader = (IndexReader) origReader.clone();
     origReader.close();
     clonedReader.close();
 
-    IndexReader r = IndexReader.open(dir1);
+    IndexReader r = IndexReader.open(dir1, false);
     assertTrue(r.isDeleted(1));
     r.close();
     dir1.close();
@@ -452,7 +424,7 @@
   public void testCloneWithSetNorm() throws Throwable {
     final Directory dir1 = new MockRAMDirectory();
     TestIndexReaderReopen.createIndex(dir1, false);
-    IndexReader orig = IndexReader.open(dir1);
+    IndexReader orig = IndexReader.open(dir1, false);
     orig.setNorm(1, "field1", 17.0f);
     final byte encoded = Similarity.encodeNorm(17.0f);
     assertEquals(encoded, orig.norms("field1")[1]);
@@ -463,7 +435,7 @@
     orig.close();
     clonedReader.close();
 
-    IndexReader r = IndexReader.open(dir1);
+    IndexReader r = IndexReader.open(dir1, false);
     assertEquals(encoded, r.norms("field1")[1]);
     r.close();
     dir1.close();
@@ -482,7 +454,7 @@
     final Directory dir1 = new MockRAMDirectory();
  
     TestIndexReaderReopen.createIndex(dir1, true);
-    IndexReader reader = IndexReader.open(dir1);
+    IndexReader reader = IndexReader.open(dir1, false);
     reader.deleteDocument(1); // acquire write lock
     IndexReader[] subs = reader.getSequentialSubReaders();
     assert subs.length > 1;
@@ -501,7 +473,7 @@
   public void testLucene1516Bug() throws Exception {
     final Directory dir1 = new MockRAMDirectory();
     TestIndexReaderReopen.createIndex(dir1, false);
-    IndexReader r1 = IndexReader.open(dir1);
+    IndexReader r1 = IndexReader.open(dir1, false);
     r1.incRef();
     IndexReader r2 = r1.clone(false);
     r1.deleteDocument(5);
@@ -523,7 +495,7 @@
     doc.add(new Field("field", "yes it's stored", Field.Store.YES, Field.Index.ANALYZED));
     w.addDocument(doc);
     w.close();
-    IndexReader r1 = IndexReader.open(dir);
+    IndexReader r1 = IndexReader.open(dir, false);
     IndexReader r2 = r1.clone(false);
     r1.close();
     r2.close();

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderCloneNorms.java Sat Oct  3 15:04:01 2009
@@ -148,10 +148,10 @@
   // try cloning and reopening the norms
   private void doTestNorms(Directory dir) throws IOException {
     addDocs(dir, 12, true);
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     verifyIndex(ir);
     modifyNormsForF1(ir);
-    IndexReader irc = (IndexReader) ir.clone();// IndexReader.open(dir);//ir.clone();
+    IndexReader irc = (IndexReader) ir.clone();// IndexReader.open(dir, false);//ir.clone();
     verifyIndex(irc);
 
     modifyNormsForF1(irc);
@@ -183,7 +183,7 @@
   public void testNormsRefCounting() throws IOException { 
     Directory dir1 = new MockRAMDirectory(); 
     TestIndexReaderReopen.createIndex(dir1, false);
-    IndexReader reader1 = IndexReader.open(dir1);
+    IndexReader reader1 = IndexReader.open(dir1, false);
         
     IndexReader reader2C = (IndexReader) reader1.clone();
     SegmentReader segmentReader2C = SegmentReader.getOnlySegmentReader(reader2C);
@@ -243,7 +243,7 @@
   }
 
   private void modifyNormsForF1(Directory dir) throws IOException {
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     modifyNormsForF1(ir);
   }
 
@@ -268,7 +268,7 @@
   }
 
   private void verifyIndex(Directory dir) throws IOException {
-    IndexReader ir = IndexReader.open(dir);
+    IndexReader ir = IndexReader.open(dir, false);
     verifyIndex(ir);
     ir.close();
   }

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=821335&r1=821334&r2=821335&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Sat Oct  3 15:04:01 2009
@@ -62,7 +62,7 @@
       }
 
       protected IndexReader openReader() throws IOException {
-        return IndexReader.open(dir1);
+        return IndexReader.open(dir1, false);
       }
       
     });
@@ -78,7 +78,7 @@
       }
 
       protected IndexReader openReader() throws IOException {
-        return IndexReader.open(dir2);
+        return IndexReader.open(dir2, false);
       }
       
     });
@@ -100,8 +100,8 @@
 
       protected IndexReader openReader() throws IOException {
         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 pr;
       }
       
@@ -123,11 +123,11 @@
 
       protected IndexReader openReader() throws IOException {
         ParallelReader pr = new ParallelReader();
-        pr.add(IndexReader.open(dir3));
-        pr.add(IndexReader.open(dir4));
+        pr.add(IndexReader.open(dir3, false));
+        pr.add(IndexReader.open(dir4, false));
         // Does not implement reopen, so
         // hits exception:
-        pr.add(new FilterIndexReader(IndexReader.open(dir3)));
+        pr.add(new FilterIndexReader(IndexReader.open(dir3, false)));
         return pr;
       }
       
@@ -164,7 +164,7 @@
   private void doTestReopenWithCommit (Directory dir, boolean withReopen) throws IOException {
     IndexWriter iwriter = new IndexWriter(dir, new KeywordAnalyzer(), true, MaxFieldLength.LIMITED);
     iwriter.setMergeScheduler(new SerialMergeScheduler());
-    IndexReader reader = IndexReader.open(dir);
+    IndexReader reader = IndexReader.open(dir, false);
     try {
       int M = 3;
       for (int i=0; i<4; i++) {
@@ -194,7 +194,7 @@
         } else {
           // recreate
           reader.close();
-          reader = IndexReader.open(dir);
+          reader = IndexReader.open(dir, false);
         }
       }
     } finally {
@@ -220,8 +220,8 @@
 
       protected IndexReader openReader() throws IOException {
         return new MultiReader(new IndexReader[] 
-                        {IndexReader.open(dir1), 
-                         IndexReader.open(dir2)});
+                        {IndexReader.open(dir1, false), 
+                         IndexReader.open(dir2, false)});
       }
       
     });
@@ -244,11 +244,11 @@
 
       protected IndexReader openReader() throws IOException {
         return new MultiReader(new IndexReader[] 
-                        {IndexReader.open(dir3), 
-                         IndexReader.open(dir4),
+                        {IndexReader.open(dir3, false), 
+                         IndexReader.open(dir4, false),
                          // Does not implement reopen, so
                          // hits exception:
-                         new FilterIndexReader(IndexReader.open(dir3))});
+                         new FilterIndexReader(IndexReader.open(dir3, false))});
       }
       
     });
@@ -280,12 +280,12 @@
 
       protected IndexReader openReader() throws IOException {
         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));
         MultiReader mr = new MultiReader(new IndexReader[] {
-            IndexReader.open(dir3), IndexReader.open(dir4)});
+            IndexReader.open(dir3, false), IndexReader.open(dir4, false)});
         return new MultiReader(new IndexReader[] {
-           pr, mr, IndexReader.open(dir5)});
+           pr, mr, IndexReader.open(dir5, false)});
       }
     });
     dir1.close();
@@ -347,7 +347,7 @@
       Directory dir1 = new MockRAMDirectory();
       createIndex(dir1, true);
      
-      IndexReader reader0 = IndexReader.open(dir1);
+      IndexReader reader0 = IndexReader.open(dir1, false);
       assertRefCountEquals(1, reader0);
 
       assertTrue(reader0 instanceof DirectoryReader);
@@ -357,7 +357,7 @@
       }
       
       // delete first document, so that only one of the subReaders have to be re-opened
-      IndexReader modifier = IndexReader.open(dir1);
+      IndexReader modifier = IndexReader.open(dir1, false);
       modifier.deleteDocument(0);
       modifier.close();
       
@@ -376,7 +376,7 @@
       }
 
       // delete first document, so that only one of the subReaders have to be re-opened
-      modifier = IndexReader.open(dir1);
+      modifier = IndexReader.open(dir1, false);
       modifier.deleteDocument(1);
       modifier.close();
 
@@ -454,10 +454,10 @@
       Directory dir2 = new MockRAMDirectory();
       createIndex(dir2, true);
       
-      IndexReader reader1 = IndexReader.open(dir1);
+      IndexReader reader1 = IndexReader.open(dir1, false);
       assertRefCountEquals(1, reader1);
 
-      IndexReader initReader2 = IndexReader.open(dir2);
+      IndexReader initReader2 = IndexReader.open(dir2, false);
       IndexReader multiReader1 = new MultiReader(new IndexReader[] {reader1, initReader2}, (mode == 0));
       modifyIndex(0, dir2);
       assertRefCountEquals(1 + mode, reader1);
@@ -525,12 +525,12 @@
       Directory dir2 = new MockRAMDirectory();
       createIndex(dir2, true);
       
-      IndexReader reader1 = IndexReader.open(dir1);
+      IndexReader reader1 = IndexReader.open(dir1, false);
       assertRefCountEquals(1, reader1);
       
       ParallelReader parallelReader1 = new ParallelReader(mode == 0);
       parallelReader1.add(reader1);
-      IndexReader initReader2 = IndexReader.open(dir2);
+      IndexReader initReader2 = IndexReader.open(dir2, false);
       parallelReader1.add(initReader2);
       modifyIndex(1, dir2);
       assertRefCountEquals(1 + mode, reader1);
@@ -597,26 +597,26 @@
     Directory dir1 = new MockRAMDirectory();
     createIndex(dir1, false);
     
-    IndexReader reader1 = IndexReader.open(dir1);
+    IndexReader reader1 = IndexReader.open(dir1, false);
     SegmentReader segmentReader1 = SegmentReader.getOnlySegmentReader(reader1);
-    IndexReader modifier = IndexReader.open(dir1);
+    IndexReader modifier = IndexReader.open(dir1, false);
     modifier.deleteDocument(0);
     modifier.close();
     
     IndexReader reader2 = reader1.reopen();
-    modifier = IndexReader.open(dir1);
+    modifier = IndexReader.open(dir1, false);
     modifier.setNorm(1, "field1", 50);
     modifier.setNorm(1, "field2", 50);
     modifier.close();
     
     IndexReader reader3 = reader2.reopen();
     SegmentReader segmentReader3 = SegmentReader.getOnlySegmentReader(reader3);
-    modifier = IndexReader.open(dir1);
+    modifier = IndexReader.open(dir1, false);
     modifier.deleteDocument(2);
     modifier.close();
 
     IndexReader reader4 = reader3.reopen();
-    modifier = IndexReader.open(dir1);
+    modifier = IndexReader.open(dir1, false);
     modifier.deleteDocument(3);
     modifier.close();
 
@@ -697,11 +697,11 @@
     final TestReopen test = new TestReopen() {      
       protected void modifyIndex(int i) throws IOException {
         if (i % 3 == 0) {
-          IndexReader modifier = IndexReader.open(dir);
+          IndexReader modifier = IndexReader.open(dir, false);
           modifier.setNorm(i, "field1", 50);
           modifier.close();
         } else if (i % 3 == 1) {
-          IndexReader modifier = IndexReader.open(dir);
+          IndexReader modifier = IndexReader.open(dir, false);
           modifier.deleteDocument(i % modifier.maxDoc());
           modifier.close();
         } else {
@@ -712,12 +712,12 @@
       }
 
       protected IndexReader openReader() throws IOException {
-        return IndexReader.open(dir);
+        return IndexReader.open(dir, false);
       }      
     };
     
     final List readers = Collections.synchronizedList(new ArrayList());
-    IndexReader firstReader = IndexReader.open(dir);
+    IndexReader firstReader = IndexReader.open(dir, false);
     IndexReader reader = firstReader;
     final Random rnd = newRandom();
     
@@ -945,7 +945,7 @@
     
     w.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, false);
     if (multiSegment) {
       assertTrue(r.getSequentialSubReaders().length > 1);
     } else {
@@ -980,7 +980,7 @@
         break;
       }
       case 1: {
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, false);
         reader.setNorm(4, "field1", 123);
         reader.setNorm(44, "field2", 222);
         reader.setNorm(44, "field4", 22);
@@ -1003,7 +1003,7 @@
         break;
       }
       case 4: {
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(dir, false);
         reader.setNorm(5, "field1", 123);
         reader.setNorm(55, "field2", 222);
         reader.close();
@@ -1081,71 +1081,11 @@
     indexDir = new File(tempDir, "IndexReaderReopen");
   }
   
-  // LUCENE-1453
-  public void testFSDirectoryReopen() throws CorruptIndexException, IOException {
-    Directory dir1 = FSDirectory.getDirectory(indexDir, null);
-    createIndex(dir1, false);
-    dir1.close();
-
-    IndexReader ir = IndexReader.open(indexDir);
-    modifyIndex(3, ir.directory());
-    IndexReader newIr = ir.reopen();
-    modifyIndex(3, newIr.directory());
-    IndexReader newIr2 = newIr.reopen();
-    modifyIndex(3, newIr2.directory());
-    IndexReader newIr3 = newIr2.reopen();
-    
-    ir.close();
-    newIr.close();
-    newIr2.close();
-    
-    // shouldn't throw Directory AlreadyClosedException
-    modifyIndex(3, newIr3.directory());
-    newIr3.close();
-  }
-
-  // LUCENE-1453
-  public void testFSDirectoryReopen2() throws CorruptIndexException, IOException {
-
-    String tempDir = System.getProperty("java.io.tmpdir");
-    if (tempDir == null)
-      throw new IOException("java.io.tmpdir undefined, cannot run test");
-    File indexDir2 = new File(tempDir, "IndexReaderReopen2");
-
-    Directory dir1 = FSDirectory.getDirectory(indexDir2);
-    createIndex(dir1, false);
-
-    IndexReader lastReader = IndexReader.open(indexDir2);
-    
-    Random r = newRandom();
-    for(int i=0;i<10;i++) {
-      int mod = r.nextInt(5);
-      modifyIndex(mod, lastReader.directory());
-      IndexReader reader = lastReader.reopen();
-      if (reader != lastReader) {
-        lastReader.close();
-        lastReader = reader;
-      }
-    }
-    lastReader.close();
-
-    // Make sure we didn't pick up too many incRef's along
-    // the way -- this close should be the final close:
-    dir1.close();
-
-    try {
-      dir1.listAll();
-      fail("did not hit AlreadyClosedException");
-    } catch (AlreadyClosedException ace) {
-      // expected
-    }
-  }
-
   public void testCloseOrig() throws Throwable {
     Directory dir = new MockRAMDirectory();
     createIndex(dir, false);
-    IndexReader r1 = IndexReader.open(dir);
-    IndexReader r2 = IndexReader.open(dir);
+    IndexReader r1 = IndexReader.open(dir, false);
+    IndexReader r2 = IndexReader.open(dir, false);
     r2.deleteDocument(0);
     r2.close();
 
@@ -1169,7 +1109,7 @@
     modifyIndex(0, dir); // Get delete bitVector on 1st segment
     modifyIndex(5, dir); // Add a doc (2 segments)
 
-    IndexReader r1 = IndexReader.open(dir); // MSR
+    IndexReader r1 = IndexReader.open(dir, false); // MSR
 
     modifyIndex(5, dir); // Add another doc (3 segments)
 
@@ -1200,7 +1140,7 @@
     createIndex(dir, false);
     // Get delete bitVector
     modifyIndex(0, dir);
-    IndexReader r1 = IndexReader.open(dir);
+    IndexReader r1 = IndexReader.open(dir, false);
 
     // Add doc:
     modifyIndex(5, dir);
@@ -1250,7 +1190,7 @@
     }
     writer.close();
 
-    IndexReader r = IndexReader.open(dir);
+    IndexReader r = IndexReader.open(dir, false);
     assertEquals(0, r.numDocs());
     assertEquals(4, r.maxDoc());
 



Mime
View raw message