diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestClassicAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestClassicAnalyzer.java index e1063592b1e..3ab1efb1335 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestClassicAnalyzer.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestClassicAnalyzer.java @@ -270,7 +270,7 @@ public class TestClassicAnalyzer extends BaseTokenStreamTestCase { writer.addDocument(doc); writer.close(); - IndexReader reader = IndexReader.open(dir, true); + IndexReader reader = IndexReader.open(dir); // Make sure all terms < max size were indexed assertEquals(2, reader.docFreq(new Term("content", "abc"))); @@ -303,7 +303,7 @@ public class TestClassicAnalyzer extends BaseTokenStreamTestCase { writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, sa)); writer.addDocument(doc); writer.close(); - reader = IndexReader.open(dir, true); + reader = IndexReader.open(dir); assertEquals(1, reader.docFreq(new Term("content", bigTerm))); reader.close(); diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java index f93e997ac9e..2f14effcafd 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java @@ -95,7 +95,7 @@ public class TestKeywordAnalyzer extends BaseTokenStreamTestCase { writer.addDocument(doc); writer.close(); - IndexReader reader = IndexReader.open(dir, true); + IndexReader reader = IndexReader.open(dir); DocsEnum td = _TestUtil.docs(random, reader, "partnum", diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java index 986fecfc1cf..61f6b7afd04 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java @@ -61,7 +61,7 @@ public class TestLimitTokenCountAnalyzer extends BaseTokenStreamTestCase { writer.addDocument(doc); writer.close(); - IndexReader reader = IndexReader.open(dir, true); + IndexReader reader = IndexReader.open(dir); Term t = new Term("field", "x"); assertEquals(1, reader.docFreq(t)); reader.close(); diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java index b0769ad4f46..47b0f11cccc 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java @@ -53,7 +53,7 @@ public class QueryAutoStopWordAnalyzerTest extends BaseTokenStreamTestCase { writer.addDocument(doc); } writer.close(); - reader = IndexReader.open(dir, true); + reader = IndexReader.open(dir); } @Override diff --git a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java index 38f4e5392c9..b784c3f5782 100644 --- a/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java +++ b/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java @@ -104,7 +104,7 @@ public class TestTeeSinkTokenFilter extends BaseTokenStreamTestCase { w.addDocument(doc); w.close(); - IndexReader r = IndexReader.open(dir, true); + IndexReader r = IndexReader.open(dir); Terms vector = r.getTermVectors(0).terms("field"); assertEquals(1, vector.getUniqueTermCount()); TermsEnum termsEnum = vector.iterator(null); diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java index ec742efccd3..3be12b7b15d 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java @@ -84,7 +84,7 @@ public abstract class ReadTask extends PerfTask { if (searcher == null) { // open our own reader Directory dir = getRunData().getDirectory(); - reader = IndexReader.open(dir, true); + reader = IndexReader.open(dir); searcher = new IndexSearcher(reader); closeSearcher = true; } else { diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/quality/utils/QualityQueriesFinder.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/quality/utils/QualityQueriesFinder.java index fc146a16004..1ca9abf2696 100755 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/quality/utils/QualityQueriesFinder.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/quality/utils/QualityQueriesFinder.java @@ -86,7 +86,7 @@ public class QualityQueriesFinder { private String [] bestTerms(String field,int numTerms) throws IOException { PriorityQueue pq = new TermsDfQueue(numTerms); - IndexReader ir = IndexReader.open(dir, true); + IndexReader ir = IndexReader.open(dir); try { int threshold = ir.maxDoc() / 10; // ignore words too common. Terms terms = MultiFields.getTerms(ir, field); diff --git a/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java b/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java index c8852526427..d43a8f0b770 100755 --- a/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java +++ b/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java @@ -102,7 +102,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)) .setOpenMode(OpenMode.APPEND)); iw.close(); - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); assertEquals("1000 docs were added to the index, this is what we expect to find!",1000,ir.numDocs()); ir.close(); } @@ -188,7 +188,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { // now we should be able to open the index for write. IndexWriter iw = new IndexWriter(benchmark.getRunData().getDirectory(), new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.APPEND)); iw.close(); - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); assertEquals("100 docs were added to the index, this is what we expect to find!",100,ir.numDocs()); ir.close(); } @@ -227,7 +227,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { // now we should be able to open the index for write. IndexWriter iw = new IndexWriter(benchmark.getRunData().getDirectory(), new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.APPEND)); iw.close(); - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); assertEquals("1000 docs were added to the index, this is what we expect to find!",1000,ir.numDocs()); ir.close(); } @@ -300,7 +300,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { // now we should be able to open the index for write. IndexWriter iw = new IndexWriter(benchmark.getRunData().getDirectory(), new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.APPEND)); iw.close(); - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); assertEquals("1 docs were added to the index, this is what we expect to find!",1,ir.numDocs()); ir.close(); } @@ -331,7 +331,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { // 3. execute the algorithm (required in every "logic" test) Benchmark benchmark = execBenchmark(algLines); - IndexReader r = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader r = IndexReader.open(benchmark.getRunData().getDirectory()); DocTermsIndex idx = FieldCache.DEFAULT.getTermsIndex(r, "country"); final int maxDoc = r.maxDoc(); assertEquals(1000, maxDoc); @@ -367,7 +367,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { Benchmark benchmark = execBenchmark(algLines); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -432,7 +432,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { .setOpenMode(OpenMode.APPEND)); iw.close(); - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); assertEquals(numLines + " lines were created but " + ir.numDocs() + " docs are in the index", numLines, ir.numDocs()); ir.close(); @@ -476,7 +476,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { } // Separately count how many tokens are actually in the index: - IndexReader reader = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader reader = IndexReader.open(benchmark.getRunData().getDirectory()); assertEquals(NUM_DOCS, reader.numDocs()); int totalTokenCount2 = 0; @@ -535,7 +535,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { Benchmark benchmark = execBenchmark(algLines); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 2 * 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -572,7 +572,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { Benchmark benchmark = execBenchmark(algLines); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -609,7 +609,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { Benchmark benchmark = execBenchmark(algLines); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -651,7 +651,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { Benchmark benchmark = execBenchmark(algLines); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 16; // first 20 reuters docs, minus 20% assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -690,7 +690,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { benchmark.getRunData().getIndexWriter().close(); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -736,7 +736,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { benchmark.getRunData().getIndexWriter().close(); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); @@ -780,7 +780,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { assertFalse(((LogMergePolicy) writer.getConfig().getMergePolicy()).getUseCompoundFile()); writer.close(); Directory dir = benchmark.getRunData().getDirectory(); - IndexReader reader = IndexReader.open(dir, true); + IndexReader reader = IndexReader.open(dir); Fields tfv = reader.getTermVectors(0); assertNotNull(tfv); assertTrue(tfv.getUniqueFieldCount() > 0); @@ -856,7 +856,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { Benchmark benchmark = execBenchmark(algLines); // 3. test number of docs in the index - IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory(), true); + IndexReader ir = IndexReader.open(benchmark.getRunData().getDirectory()); int ndocsExpected = 20; // first 20 reuters docs. assertEquals("wrong number of docs in the index!", ndocsExpected, ir.numDocs()); ir.close(); diff --git a/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java b/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java index 7a2f8d237ba..26d9414c2f1 100644 --- a/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java +++ b/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java @@ -76,7 +76,7 @@ public class TestParser extends LuceneTestCase { } d.close(); writer.close(); - reader = IndexReader.open(dir, true); + reader = IndexReader.open(dir); searcher = newSearcher(reader); } diff --git a/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java b/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java index e409fa34e4d..27948f1b1fe 100644 --- a/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java +++ b/modules/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java @@ -63,7 +63,7 @@ public class TestNumericRangeFilterBuilder extends LuceneTestCase { IndexWriter writer = new IndexWriter(ramDir, newIndexWriterConfig(TEST_VERSION_CURRENT, null)); writer.commit(); try { - IndexReader reader = new SlowMultiReaderWrapper(IndexReader.open(ramDir, true)); + IndexReader reader = new SlowMultiReaderWrapper(IndexReader.open(ramDir)); try { assertNull(filter.getDocIdSet((AtomicReaderContext) reader.getTopReaderContext(), reader.getLiveDocs())); } diff --git a/modules/suggest/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java b/modules/suggest/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java index f8c6c831889..c18b2c5fefc 100644 --- a/modules/suggest/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java +++ b/modules/suggest/src/test/org/apache/lucene/search/spell/TestLuceneDictionary.java @@ -84,7 +84,7 @@ public class TestLuceneDictionary extends LuceneTestCase { public void testFieldNonExistent() throws IOException { try { - indexReader = IndexReader.open(store, true); + indexReader = IndexReader.open(store); ld = new LuceneDictionary(indexReader, "nonexistent_field"); it = ld.getWordsIterator(); @@ -98,7 +98,7 @@ public class TestLuceneDictionary extends LuceneTestCase { public void testFieldAaa() throws IOException { try { - indexReader = IndexReader.open(store, true); + indexReader = IndexReader.open(store); ld = new LuceneDictionary(indexReader, "aaa"); it = ld.getWordsIterator(); @@ -114,7 +114,7 @@ public class TestLuceneDictionary extends LuceneTestCase { public void testFieldContents_1() throws IOException { try { - indexReader = IndexReader.open(store, true); + indexReader = IndexReader.open(store); ld = new LuceneDictionary(indexReader, "contents"); it = ld.getWordsIterator(); @@ -144,7 +144,7 @@ public class TestLuceneDictionary extends LuceneTestCase { public void testFieldContents_2() throws IOException { try { - indexReader = IndexReader.open(store, true); + indexReader = IndexReader.open(store); ld = new LuceneDictionary(indexReader, "contents"); it = ld.getWordsIterator(); @@ -176,7 +176,7 @@ public class TestLuceneDictionary extends LuceneTestCase { public void testFieldZzz() throws IOException { try { - indexReader = IndexReader.open(store, true); + indexReader = IndexReader.open(store); ld = new LuceneDictionary(indexReader, "zzz"); it = ld.getWordsIterator(); @@ -194,7 +194,7 @@ public class TestLuceneDictionary extends LuceneTestCase { public void testSpellchecker() throws IOException { Directory dir = newDirectory(); SpellChecker sc = new SpellChecker(dir); - indexReader = IndexReader.open(store, true); + indexReader = IndexReader.open(store); sc.indexDictionary(new LuceneDictionary(indexReader, "contents"), newIndexWriterConfig(TEST_VERSION_CURRENT, null), false); String[] suggestions = sc.suggestSimilar("Tam", 1); assertEquals(1, suggestions.length); diff --git a/modules/suggest/src/test/org/apache/lucene/search/spell/TestSpellChecker.java b/modules/suggest/src/test/org/apache/lucene/search/spell/TestSpellChecker.java index f5e7324d30c..0799bb0a53c 100755 --- a/modules/suggest/src/test/org/apache/lucene/search/spell/TestSpellChecker.java +++ b/modules/suggest/src/test/org/apache/lucene/search/spell/TestSpellChecker.java @@ -104,7 +104,7 @@ public class TestSpellChecker extends LuceneTestCase { public void testBuild() throws CorruptIndexException, IOException { - IndexReader r = IndexReader.open(userindex, true); + IndexReader r = IndexReader.open(userindex); spellChecker.clearIndex(); @@ -144,7 +144,7 @@ public class TestSpellChecker extends LuceneTestCase { } public void testComparator() throws Exception { - IndexReader r = IndexReader.open(userindex, true); + IndexReader r = IndexReader.open(userindex); Directory compIdx = newDirectory(); SpellChecker compareSP = new SpellCheckerMock(compIdx, new LevensteinDistance(), new SuggestWordFrequencyComparator()); addwords(r, compareSP, "field3"); @@ -162,7 +162,7 @@ public class TestSpellChecker extends LuceneTestCase { } public void testBogusField() throws Exception { - IndexReader r = IndexReader.open(userindex, true); + IndexReader r = IndexReader.open(userindex); Directory compIdx = newDirectory(); SpellChecker compareSP = new SpellCheckerMock(compIdx, new LevensteinDistance(), new SuggestWordFrequencyComparator()); addwords(r, compareSP, "field3"); @@ -177,7 +177,7 @@ public class TestSpellChecker extends LuceneTestCase { } public void testSuggestModes() throws Exception { - IndexReader r = IndexReader.open(userindex, true); + IndexReader r = IndexReader.open(userindex); spellChecker.clearIndex(); addwords(r, spellChecker, "field1"); @@ -337,7 +337,7 @@ public class TestSpellChecker extends LuceneTestCase { } private int numdoc() throws IOException { - IndexReader rs = IndexReader.open(spellindex, true); + IndexReader rs = IndexReader.open(spellindex); int num = rs.numDocs(); assertTrue(num != 0); //System.out.println("num docs: " + num); @@ -346,7 +346,7 @@ public class TestSpellChecker extends LuceneTestCase { } public void testClose() throws IOException { - IndexReader r = IndexReader.open(userindex, true); + IndexReader r = IndexReader.open(userindex); spellChecker.clearIndex(); String field = "field1"; addwords(r, spellChecker, "field1"); @@ -402,7 +402,7 @@ public class TestSpellChecker extends LuceneTestCase { */ public void testConcurrentAccess() throws IOException, InterruptedException { assertEquals(1, searchers.size()); - final IndexReader r = IndexReader.open(userindex, true); + final IndexReader r = IndexReader.open(userindex); spellChecker.clearIndex(); assertEquals(2, searchers.size()); addwords(r, spellChecker, "field1");