diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 680a05a3a9d..a2909216e5e 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -228,7 +228,7 @@ Changes in backwards compatibility policy Similarity to use an external byte[] or one of the new DocValues fields (LUCENE-3108). Alternatively, to dynamically change norms (boost *and* length norm) at query time, wrap your AtomicReader using - FilterIndexReader, overriding FilterIndexReader.norms(). To persist the + FilterAtomicReader, overriding FilterAtomicReader.norms(). To persist the changes on disk, copy the FilteredIndexReader to a new index using IndexWriter.addIndexes(). (Uwe Schindler, Robert Muir) @@ -240,10 +240,11 @@ Changes in backwards compatibility policy FieldInfo.IndexOption: DOCS_AND_POSITIONS_AND_OFFSETS. (Robert Muir, Mike McCandless) -* LUCENE-2858: FilterIndexReader now extends AtomicReader. If you want to - filter composite readers like DirectoryReader or MultiReader, filter - their atomic leaves and build a new CompositeReader (e.g. MultiReader) - around them. (Uwe Schindler, Robert Muir) +* LUCENE-2858, LUCENE-3770: FilterIndexReader was renamed to + FilterAtomicReader and now extends AtomicReader. If you want to filter + composite readers like DirectoryReader or MultiReader, filter their + atomic leaves and build a new CompositeReader (e.g. MultiReader) around + them. (Uwe Schindler, Robert Muir) * LUCENE-3736: ParallelReader was split into ParallelAtomicReader and ParallelCompositeReader. Lucene 3.x's ParallelReader is now diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java b/lucene/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java index 2bb2548f828..b6dc23b5a53 100644 --- a/lucene/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java +++ b/lucene/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java @@ -209,7 +209,7 @@ public class MultiPassIndexSplitter { // as we pass the subreaders directly to IW.addIndexes(). } - private static final class FakeDeleteAtomicIndexReader extends FilterIndexReader { + private static final class FakeDeleteAtomicIndexReader extends FilterAtomicReader { FixedBitSet liveDocs; public FakeDeleteAtomicIndexReader(AtomicReader reader) { diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java b/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java index aa2f4ea25c2..b89d2756288 100644 --- a/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java +++ b/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java @@ -117,7 +117,7 @@ public class PKIndexSplitter { } } - private static class DocumentFilteredAtomicIndexReader extends FilterIndexReader { + private static class DocumentFilteredAtomicIndexReader extends FilterAtomicReader { final Bits liveDocs; final int numDocs; diff --git a/lucene/core/src/java/org/apache/lucene/index/FilterIndexReader.java b/lucene/core/src/java/org/apache/lucene/index/FilterAtomicReader.java similarity index 97% rename from lucene/core/src/java/org/apache/lucene/index/FilterIndexReader.java rename to lucene/core/src/java/org/apache/lucene/index/FilterAtomicReader.java index 3a5527671ca..9bf15eed592 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FilterIndexReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/FilterAtomicReader.java @@ -23,16 +23,16 @@ import org.apache.lucene.util.BytesRef; import java.io.IOException; import java.util.Comparator; -/** A FilterIndexReader contains another IndexReader, which it +/** A FilterAtomicReader contains another AtomicReader, which it * uses as its basic source of data, possibly transforming the data along the * way or providing additional functionality. The class * FilterIndexReader itself simply implements all abstract methods * of IndexReader with versions that pass all requests to the - * contained index reader. Subclasses of FilterIndexReader may + * contained index reader. Subclasses of FilterAtomicReader may * further override some of these methods and may also provide additional * methods and fields. */ -public class FilterIndexReader extends AtomicReader { +public class FilterAtomicReader extends AtomicReader { /** Base class for filtering {@link Fields} * implementations. */ @@ -279,7 +279,7 @@ public class FilterIndexReader extends AtomicReader { *

Note that base reader is closed if this FilterIndexReader is closed.

* @param in specified base reader. */ - public FilterIndexReader(AtomicReader in) { + public FilterAtomicReader(AtomicReader in) { super(); this.in = in; } diff --git a/lucene/core/src/test/org/apache/lucene/index/TestFilterIndexReader.java b/lucene/core/src/test/org/apache/lucene/index/TestFilterAtomicReader.java similarity index 95% rename from lucene/core/src/test/org/apache/lucene/index/TestFilterIndexReader.java rename to lucene/core/src/test/org/apache/lucene/index/TestFilterAtomicReader.java index bc761fbef34..f6caef61cc7 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestFilterIndexReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestFilterAtomicReader.java @@ -33,9 +33,9 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.ReaderUtil; -public class TestFilterIndexReader extends LuceneTestCase { +public class TestFilterAtomicReader extends LuceneTestCase { - private static class TestReader extends FilterIndexReader { + private static class TestReader extends FilterAtomicReader { /** Filter that only permits terms containing 'e'.*/ private static class TestFields extends FilterFields { @@ -179,14 +179,14 @@ public class TestFilterIndexReader extends LuceneTestCase { public void testOverrideMethods() throws Exception { boolean fail = false; - for (Method m : FilterIndexReader.class.getMethods()) { + for (Method m : FilterAtomicReader.class.getMethods()) { int mods = m.getModifiers(); if (Modifier.isStatic(mods) || Modifier.isFinal(mods) || m.isSynthetic()) { continue; } Class declaringClass = m.getDeclaringClass(); String name = m.getName(); - if (declaringClass != FilterIndexReader.class && declaringClass != Object.class) { + if (declaringClass != FilterAtomicReader.class && declaringClass != Object.class) { System.err.println("method is not overridden by FilterIndexReader: " + name); fail = true; } diff --git a/solr/core/src/test/org/apache/solr/search/TestDocSet.java b/solr/core/src/test/org/apache/solr/search/TestDocSet.java index 0ef03e9fa2d..6449c09f932 100644 --- a/solr/core/src/test/org/apache/solr/search/TestDocSet.java +++ b/solr/core/src/test/org/apache/solr/search/TestDocSet.java @@ -22,7 +22,7 @@ import java.util.Arrays; import java.util.Random; import org.apache.lucene.index.FieldInfos; -import org.apache.lucene.index.FilterIndexReader; +import org.apache.lucene.index.FilterAtomicReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.MultiReader; @@ -338,7 +338,7 @@ public class TestDocSet extends LuceneTestCase { public IndexReader dummyIndexReader(final int maxDoc) { // TODO FIXME: THIS IS HEAVY BROKEN AND ILLEGAL TO DO (null delegate): - IndexReader r = new FilterIndexReader(null) { + IndexReader r = new FilterAtomicReader(null) { @Override public int maxDoc() { return maxDoc;