mirror of https://github.com/apache/lucene.git
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.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1243051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0095bd10fd
commit
d17d600da5
|
@ -228,7 +228,7 @@ Changes in backwards compatibility policy
|
||||||
Similarity to use an external byte[] or one of the new DocValues
|
Similarity to use an external byte[] or one of the new DocValues
|
||||||
fields (LUCENE-3108). Alternatively, to dynamically change norms (boost
|
fields (LUCENE-3108). Alternatively, to dynamically change norms (boost
|
||||||
*and* length norm) at query time, wrap your AtomicReader using
|
*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
|
changes on disk, copy the FilteredIndexReader to a new index using
|
||||||
IndexWriter.addIndexes(). (Uwe Schindler, Robert Muir)
|
IndexWriter.addIndexes(). (Uwe Schindler, Robert Muir)
|
||||||
|
|
||||||
|
@ -240,10 +240,11 @@ Changes in backwards compatibility policy
|
||||||
FieldInfo.IndexOption: DOCS_AND_POSITIONS_AND_OFFSETS. (Robert
|
FieldInfo.IndexOption: DOCS_AND_POSITIONS_AND_OFFSETS. (Robert
|
||||||
Muir, Mike McCandless)
|
Muir, Mike McCandless)
|
||||||
|
|
||||||
* LUCENE-2858: FilterIndexReader now extends AtomicReader. If you want to
|
* LUCENE-2858, LUCENE-3770: FilterIndexReader was renamed to
|
||||||
filter composite readers like DirectoryReader or MultiReader, filter
|
FilterAtomicReader and now extends AtomicReader. If you want to filter
|
||||||
their atomic leaves and build a new CompositeReader (e.g. MultiReader)
|
composite readers like DirectoryReader or MultiReader, filter their
|
||||||
around them. (Uwe Schindler, Robert Muir)
|
atomic leaves and build a new CompositeReader (e.g. MultiReader) around
|
||||||
|
them. (Uwe Schindler, Robert Muir)
|
||||||
|
|
||||||
* LUCENE-3736: ParallelReader was split into ParallelAtomicReader
|
* LUCENE-3736: ParallelReader was split into ParallelAtomicReader
|
||||||
and ParallelCompositeReader. Lucene 3.x's ParallelReader is now
|
and ParallelCompositeReader. Lucene 3.x's ParallelReader is now
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class MultiPassIndexSplitter {
|
||||||
// as we pass the subreaders directly to IW.addIndexes().
|
// 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;
|
FixedBitSet liveDocs;
|
||||||
|
|
||||||
public FakeDeleteAtomicIndexReader(AtomicReader reader) {
|
public FakeDeleteAtomicIndexReader(AtomicReader reader) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class PKIndexSplitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DocumentFilteredAtomicIndexReader extends FilterIndexReader {
|
private static class DocumentFilteredAtomicIndexReader extends FilterAtomicReader {
|
||||||
final Bits liveDocs;
|
final Bits liveDocs;
|
||||||
final int numDocs;
|
final int numDocs;
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,16 @@ import org.apache.lucene.util.BytesRef;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
/** A <code>FilterIndexReader</code> contains another IndexReader, which it
|
/** A <code>FilterAtomicReader</code> contains another AtomicReader, which it
|
||||||
* uses as its basic source of data, possibly transforming the data along the
|
* uses as its basic source of data, possibly transforming the data along the
|
||||||
* way or providing additional functionality. The class
|
* way or providing additional functionality. The class
|
||||||
* <code>FilterIndexReader</code> itself simply implements all abstract methods
|
* <code>FilterIndexReader</code> itself simply implements all abstract methods
|
||||||
* of <code>IndexReader</code> with versions that pass all requests to the
|
* of <code>IndexReader</code> with versions that pass all requests to the
|
||||||
* contained index reader. Subclasses of <code>FilterIndexReader</code> may
|
* contained index reader. Subclasses of <code>FilterAtomicReader</code> may
|
||||||
* further override some of these methods and may also provide additional
|
* further override some of these methods and may also provide additional
|
||||||
* methods and fields.
|
* methods and fields.
|
||||||
*/
|
*/
|
||||||
public class FilterIndexReader extends AtomicReader {
|
public class FilterAtomicReader extends AtomicReader {
|
||||||
|
|
||||||
/** Base class for filtering {@link Fields}
|
/** Base class for filtering {@link Fields}
|
||||||
* implementations. */
|
* implementations. */
|
||||||
|
@ -279,7 +279,7 @@ public class FilterIndexReader extends AtomicReader {
|
||||||
* <p>Note that base reader is closed if this FilterIndexReader is closed.</p>
|
* <p>Note that base reader is closed if this FilterIndexReader is closed.</p>
|
||||||
* @param in specified base reader.
|
* @param in specified base reader.
|
||||||
*/
|
*/
|
||||||
public FilterIndexReader(AtomicReader in) {
|
public FilterAtomicReader(AtomicReader in) {
|
||||||
super();
|
super();
|
||||||
this.in = in;
|
this.in = in;
|
||||||
}
|
}
|
|
@ -33,9 +33,9 @@ import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.apache.lucene.util.ReaderUtil;
|
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'.*/
|
/** Filter that only permits terms containing 'e'.*/
|
||||||
private static class TestFields extends FilterFields {
|
private static class TestFields extends FilterFields {
|
||||||
|
@ -179,14 +179,14 @@ public class TestFilterIndexReader extends LuceneTestCase {
|
||||||
|
|
||||||
public void testOverrideMethods() throws Exception {
|
public void testOverrideMethods() throws Exception {
|
||||||
boolean fail = false;
|
boolean fail = false;
|
||||||
for (Method m : FilterIndexReader.class.getMethods()) {
|
for (Method m : FilterAtomicReader.class.getMethods()) {
|
||||||
int mods = m.getModifiers();
|
int mods = m.getModifiers();
|
||||||
if (Modifier.isStatic(mods) || Modifier.isFinal(mods) || m.isSynthetic()) {
|
if (Modifier.isStatic(mods) || Modifier.isFinal(mods) || m.isSynthetic()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Class<?> declaringClass = m.getDeclaringClass();
|
Class<?> declaringClass = m.getDeclaringClass();
|
||||||
String name = m.getName();
|
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);
|
System.err.println("method is not overridden by FilterIndexReader: " + name);
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@ import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.apache.lucene.index.FieldInfos;
|
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.IndexReader;
|
||||||
import org.apache.lucene.index.AtomicReaderContext;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.index.MultiReader;
|
import org.apache.lucene.index.MultiReader;
|
||||||
|
@ -338,7 +338,7 @@ public class TestDocSet extends LuceneTestCase {
|
||||||
|
|
||||||
public IndexReader dummyIndexReader(final int maxDoc) {
|
public IndexReader dummyIndexReader(final int maxDoc) {
|
||||||
// TODO FIXME: THIS IS HEAVY BROKEN AND ILLEGAL TO DO (null delegate):
|
// TODO FIXME: THIS IS HEAVY BROKEN AND ILLEGAL TO DO (null delegate):
|
||||||
IndexReader r = new FilterIndexReader(null) {
|
IndexReader r = new FilterAtomicReader(null) {
|
||||||
@Override
|
@Override
|
||||||
public int maxDoc() {
|
public int maxDoc() {
|
||||||
return maxDoc;
|
return maxDoc;
|
||||||
|
|
Loading…
Reference in New Issue