LUCENE-2858: Rename AtomicIndexReader -> AtomicReader, CompositeIndexReader -> CompositeReader. Contexts not yet changed!

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene2858@1237508 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-01-29 23:50:54 +00:00
parent 10ba9abeb2
commit 2d4c738067
225 changed files with 470 additions and 494 deletions

View File

@ -31,7 +31,7 @@ import org.apache.lucene.analysis.CachingTokenFilter;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.memory.MemoryIndex; import org.apache.lucene.index.memory.MemoryIndex;
import org.apache.lucene.search.*; import org.apache.lucene.search.*;
import org.apache.lucene.search.spans.FieldMaskingSpanQuery; import org.apache.lucene.search.spans.FieldMaskingSpanQuery;

View File

@ -34,7 +34,7 @@ import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.Collector; import org.apache.lucene.search.Collector;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.PhraseQuery; import org.apache.lucene.search.PhraseQuery;

View File

@ -33,7 +33,7 @@ import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.Norm; import org.apache.lucene.index.Norm;
import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
@ -42,7 +42,7 @@ import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.Fields; import org.apache.lucene.index.Fields;
import org.apache.lucene.index.FieldsEnum; import org.apache.lucene.index.FieldsEnum;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.OrdTermState; import org.apache.lucene.index.OrdTermState;
import org.apache.lucene.index.StoredFieldVisitor; import org.apache.lucene.index.StoredFieldVisitor;
@ -750,7 +750,7 @@ public class MemoryIndex {
* Search support for Lucene framework integration; implements all methods * Search support for Lucene framework integration; implements all methods
* required by the Lucene IndexReader contracts. * required by the Lucene IndexReader contracts.
*/ */
private final class MemoryIndexReader extends AtomicIndexReader { private final class MemoryIndexReader extends AtomicReader {
private IndexSearcher searcher; // needed to find searcher.getSimilarity() private IndexSearcher searcher; // needed to find searcher.getSimilarity()

View File

@ -33,7 +33,7 @@ import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field; import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField; import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
@ -186,7 +186,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
Analyzer analyzer = new MockAnalyzer(random); Analyzer analyzer = new MockAnalyzer(random);
MemoryIndex memory = new MemoryIndex(); MemoryIndex memory = new MemoryIndex();
memory.addField("foo", "bar", analyzer); memory.addField("foo", "bar", analyzer);
AtomicIndexReader reader = (AtomicIndexReader) memory.createSearcher().getIndexReader(); AtomicReader reader = (AtomicReader) memory.createSearcher().getIndexReader();
DocsEnum disi = _TestUtil.docs(random, reader, "foo", new BytesRef("bar"), null, null, false); DocsEnum disi = _TestUtil.docs(random, reader, "foo", new BytesRef("bar"), null, null, false);
int docid = disi.docID(); int docid = disi.docID();
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS); assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);
@ -206,7 +206,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
Analyzer analyzer = new MockAnalyzer(random); Analyzer analyzer = new MockAnalyzer(random);
MemoryIndex memory = new MemoryIndex(); MemoryIndex memory = new MemoryIndex();
memory.addField("foo", "bar", analyzer); memory.addField("foo", "bar", analyzer);
AtomicIndexReader reader = (AtomicIndexReader) memory.createSearcher().getIndexReader(); AtomicReader reader = (AtomicReader) memory.createSearcher().getIndexReader();
DocsAndPositionsEnum disi = reader.termPositionsEnum(null, "foo", new BytesRef("bar"), false); DocsAndPositionsEnum disi = reader.termPositionsEnum(null, "foo", new BytesRef("bar"), false);
int docid = disi.docID(); int docid = disi.docID();
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS); assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);

View File

@ -182,15 +182,15 @@ public class MultiPassIndexSplitter {
super(initSubReaders(reader), false /* dont close */); super(initSubReaders(reader), false /* dont close */);
} }
private static AtomicIndexReader[] initSubReaders(IndexReader reader) throws IOException { private static AtomicReader[] initSubReaders(IndexReader reader) throws IOException {
final ArrayList<AtomicIndexReader> subs = new ArrayList<AtomicIndexReader>(); final ArrayList<AtomicReader> subs = new ArrayList<AtomicReader>();
new ReaderUtil.Gather(reader) { new ReaderUtil.Gather(reader) {
@Override @Override
protected void add(int base, AtomicIndexReader r) { protected void add(int base, AtomicReader r) {
subs.add(new FakeDeleteAtomicIndexReader(r)); subs.add(new FakeDeleteAtomicIndexReader(r));
} }
}.run(); }.run();
return subs.toArray(new AtomicIndexReader[subs.size()]); return subs.toArray(new AtomicReader[subs.size()]);
} }
public void deleteDocument(int docID) { public void deleteDocument(int docID) {
@ -226,7 +226,7 @@ public class MultiPassIndexSplitter {
private static final class FakeDeleteAtomicIndexReader extends FilterIndexReader { private static final class FakeDeleteAtomicIndexReader extends FilterIndexReader {
FixedBitSet liveDocs; FixedBitSet liveDocs;
public FakeDeleteAtomicIndexReader(AtomicIndexReader reader) { public FakeDeleteAtomicIndexReader(AtomicReader reader) {
super(reader); super(reader);
undeleteAll(); // initialize main bitset undeleteAll(); // initialize main bitset
} }

View File

@ -20,7 +20,7 @@ package org.apache.lucene.index;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;

View File

@ -17,7 +17,7 @@ package org.apache.lucene.misc;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.MultiFields;
import org.apache.lucene.index.Fields; import org.apache.lucene.index.Fields;
@ -188,7 +188,7 @@ public class HighFreqTerms {
new ReaderUtil.Gather(reader) { new ReaderUtil.Gather(reader) {
@Override @Override
protected void add(int base, AtomicIndexReader r) throws IOException { protected void add(int base, AtomicReader r) throws IOException {
Bits liveDocs = r.getLiveDocs(); Bits liveDocs = r.getLiveDocs();
if (liveDocs == null) { if (liveDocs == null) {
// TODO: we could do this up front, during the scan // TODO: we could do this up front, during the scan

View File

@ -17,7 +17,7 @@ package org.apache.lucene.sandbox.queries;
*/ */
import org.apache.lucene.index.*; import org.apache.lucene.index.*;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
@ -78,7 +78,7 @@ public class DuplicateFilter extends Filter {
} }
} }
private FixedBitSet correctBits(AtomicIndexReader reader, Bits acceptDocs) throws IOException { private FixedBitSet correctBits(AtomicReader reader, Bits acceptDocs) throws IOException {
FixedBitSet bits = new FixedBitSet(reader.maxDoc()); //assume all are INvalid FixedBitSet bits = new FixedBitSet(reader.maxDoc()); //assume all are INvalid
Terms terms = reader.fields().terms(fieldName); Terms terms = reader.fields().terms(fieldName);
@ -115,7 +115,7 @@ public class DuplicateFilter extends Filter {
return bits; return bits;
} }
private FixedBitSet fastBits(AtomicIndexReader reader, Bits acceptDocs) throws IOException { private FixedBitSet fastBits(AtomicReader reader, Bits acceptDocs) throws IOException {
FixedBitSet bits = new FixedBitSet(reader.maxDoc()); FixedBitSet bits = new FixedBitSet(reader.maxDoc());
bits.set(0, reader.maxDoc()); //assume all are valid bits.set(0, reader.maxDoc()); //assume all are valid
Terms terms = reader.fields().terms(fieldName); Terms terms = reader.fields().terms(fieldName);

View File

@ -20,7 +20,7 @@ package org.apache.lucene.sandbox.queries;
import java.io.IOException; import java.io.IOException;
import java.text.Collator; import java.text.Collator;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.FieldCache.DocTerms; import org.apache.lucene.search.FieldCache.DocTerms;
import org.apache.lucene.search.FieldComparator; import org.apache.lucene.search.FieldComparator;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.spatial.geohash;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.FieldCache.DocTerms; import org.apache.lucene.search.FieldCache.DocTerms;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;

View File

@ -20,7 +20,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.spatial.tier;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.search.FieldComparator; import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.FieldComparatorSource; import org.apache.lucene.search.FieldComparatorSource;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.spatial.tier;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.FilteredDocIdSet; import org.apache.lucene.search.FilteredDocIdSet;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;

View File

@ -24,7 +24,7 @@ import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.NumericField; import org.apache.lucene.document.NumericField;
import org.apache.lucene.document.TextField; import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;

View File

@ -20,7 +20,7 @@ import java.io.IOException;
import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.MergeState; import org.apache.lucene.index.MergeState;
import org.apache.lucene.index.DocValues.Type; import org.apache.lucene.index.DocValues.Type;
@ -65,13 +65,13 @@ public abstract class PerDocConsumer implements Closeable {
/** /**
* Returns a {@link DocValues} instance for merging from the given reader for the given * Returns a {@link DocValues} instance for merging from the given reader for the given
* {@link FieldInfo}. This method is used for merging and uses * {@link FieldInfo}. This method is used for merging and uses
* {@link AtomicIndexReader#docValues(String)} by default. * {@link AtomicReader#docValues(String)} by default.
* <p> * <p>
* To enable {@link DocValues} merging for different {@link DocValues} than * To enable {@link DocValues} merging for different {@link DocValues} than
* the default override this method accordingly. * the default override this method accordingly.
* <p> * <p>
*/ */
protected DocValues getDocValuesForMerge(AtomicIndexReader reader, FieldInfo info) throws IOException { protected DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info) throws IOException {
return reader.docValues(info.name); return reader.docValues(info.name);
} }

View File

@ -26,7 +26,7 @@ import org.apache.lucene.index.DocValues.Type;
import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos; import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexFileNames; import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.PerDocWriteState; import org.apache.lucene.index.PerDocWriteState;
import org.apache.lucene.index.SegmentInfo; import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.SegmentReadState; import org.apache.lucene.index.SegmentReadState;
@ -88,7 +88,7 @@ public class Lucene40NormsFormat extends NormsFormat {
} }
@Override @Override
protected DocValues getDocValuesForMerge(AtomicIndexReader reader, FieldInfo info) protected DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info)
throws IOException { throws IOException {
return reader.normValues(info.name); return reader.normValues(info.name);
} }

View File

@ -28,7 +28,7 @@ import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos; import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexFileNames; import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.SegmentInfo; import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
@ -87,7 +87,7 @@ public class SimpleTextNormsConsumer extends PerDocConsumer {
} }
@Override @Override
protected DocValues getDocValuesForMerge(AtomicIndexReader reader, FieldInfo info) protected DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info)
throws IOException { throws IOException {
return reader.normValues(info.name); return reader.normValues(info.name);
} }

View File

@ -17,17 +17,9 @@ package org.apache.lucene.index;
* limitations under the License. * limitations under the License.
*/ */
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.lucene.index.CompositeIndexReader.CompositeReaderContext; import org.apache.lucene.index.CompositeReader.CompositeReaderContext;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.DocumentStoredFieldVisitor;
import org.apache.lucene.search.SearcherManager; // javadocs import org.apache.lucene.search.SearcherManager; // javadocs
import org.apache.lucene.store.*; import org.apache.lucene.store.*;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
@ -66,11 +58,11 @@ import org.apache.lucene.util.ReaderUtil; // for javadocs
<code>IndexReader</code> instance; use your own <code>IndexReader</code> instance; use your own
(non-Lucene) objects instead. (non-Lucene) objects instead.
*/ */
public abstract class AtomicIndexReader extends IndexReader { public abstract class AtomicReader extends IndexReader {
private final AtomicReaderContext readerContext = new AtomicReaderContext(this); private final AtomicReaderContext readerContext = new AtomicReaderContext(this);
protected AtomicIndexReader() { protected AtomicReader() {
super(); super();
} }
@ -287,7 +279,7 @@ public abstract class AtomicIndexReader extends IndexReader {
public abstract Bits getLiveDocs(); public abstract Bits getLiveDocs();
/** /**
* {@link ReaderContext} for {@link AtomicIndexReader} instances * {@link ReaderContext} for {@link AtomicReader} instances
* @lucene.experimental * @lucene.experimental
*/ */
public static final class AtomicReaderContext extends ReaderContext { public static final class AtomicReaderContext extends ReaderContext {
@ -296,12 +288,12 @@ public abstract class AtomicIndexReader extends IndexReader {
/** The readers absolute doc base */ /** The readers absolute doc base */
public final int docBase; public final int docBase;
private final AtomicIndexReader reader; private final AtomicReader reader;
/** /**
* Creates a new {@link AtomicReaderContext} * Creates a new {@link AtomicReaderContext}
*/ */
public AtomicReaderContext(CompositeReaderContext parent, AtomicIndexReader reader, public AtomicReaderContext(CompositeReaderContext parent, AtomicReader reader,
int ord, int docBase, int leafOrd, int leafDocBase) { int ord, int docBase, int leafOrd, int leafDocBase) {
super(parent, ord, docBase); super(parent, ord, docBase);
this.ord = leafOrd; this.ord = leafOrd;
@ -309,7 +301,7 @@ public abstract class AtomicIndexReader extends IndexReader {
this.reader = reader; this.reader = reader;
} }
public AtomicReaderContext(AtomicIndexReader atomicReader) { public AtomicReaderContext(AtomicReader atomicReader) {
this(null, atomicReader, 0, 0, 0, 0); this(null, atomicReader, 0, 0, 0, 0);
} }
@ -324,7 +316,7 @@ public abstract class AtomicIndexReader extends IndexReader {
} }
@Override @Override
public AtomicIndexReader reader() { public AtomicReader reader() {
return reader; return reader;
} }
} }

View File

@ -23,7 +23,7 @@ import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ReaderUtil; import org.apache.lucene.util.ReaderUtil;
abstract class BaseMultiReader<R extends IndexReader> extends CompositeIndexReader { abstract class BaseMultiReader<R extends IndexReader> extends CompositeReader {
protected final R[] subReaders; protected final R[] subReaders;
protected final int[] starts; // 1st docno for each segment protected final int[] starts; // 1st docno for each segment
private final int maxDoc; private final int maxDoc;

View File

@ -25,7 +25,7 @@ import java.util.Collections;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;

View File

@ -17,24 +17,10 @@ package org.apache.lucene.index;
* limitations under the License. * limitations under the License.
*/ */
import java.io.Closeable; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.DocumentStoredFieldVisitor;
import org.apache.lucene.search.SearcherManager; // javadocs import org.apache.lucene.search.SearcherManager; // javadocs
import org.apache.lucene.store.*; import org.apache.lucene.store.*;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ReaderUtil; // for javadocs import org.apache.lucene.util.ReaderUtil; // for javadocs
import org.apache.lucene.util.SetOnce;
/** IndexReader is an abstract class, providing an interface for accessing an /** IndexReader is an abstract class, providing an interface for accessing an
index. Search of an index is done entirely through this abstract interface, index. Search of an index is done entirely through this abstract interface,
@ -68,11 +54,11 @@ import org.apache.lucene.util.SetOnce;
<code>IndexReader</code> instance; use your own <code>IndexReader</code> instance; use your own
(non-Lucene) objects instead. (non-Lucene) objects instead.
*/ */
public abstract class CompositeIndexReader extends IndexReader { public abstract class CompositeReader extends IndexReader {
private CompositeReaderContext readerContext = null; // lazy init private CompositeReaderContext readerContext = null; // lazy init
protected CompositeIndexReader() { protected CompositeReader() {
super(); super();
} }
@ -113,19 +99,19 @@ public abstract class CompositeIndexReader extends IndexReader {
public abstract IndexReader[] getSequentialSubReaders(); public abstract IndexReader[] getSequentialSubReaders();
/** /**
* {@link ReaderContext} for {@link CompositeIndexReader} instance. * {@link ReaderContext} for {@link CompositeReader} instance.
* @lucene.experimental * @lucene.experimental
*/ */
public static final class CompositeReaderContext extends ReaderContext { public static final class CompositeReaderContext extends ReaderContext {
private final ReaderContext[] children; private final ReaderContext[] children;
private final AtomicReaderContext[] leaves; private final AtomicReaderContext[] leaves;
private final CompositeIndexReader reader; private final CompositeReader reader;
/** /**
* Creates a {@link CompositeReaderContext} for intermediate readers that aren't * Creates a {@link CompositeReaderContext} for intermediate readers that aren't
* not top-level readers in the current context * not top-level readers in the current context
*/ */
public CompositeReaderContext(CompositeReaderContext parent, CompositeIndexReader reader, public CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader,
int ordInParent, int docbaseInParent, ReaderContext[] children) { int ordInParent, int docbaseInParent, ReaderContext[] children) {
this(parent, reader, ordInParent, docbaseInParent, children, null); this(parent, reader, ordInParent, docbaseInParent, children, null);
} }
@ -133,11 +119,11 @@ public abstract class CompositeIndexReader extends IndexReader {
/** /**
* Creates a {@link CompositeReaderContext} for top-level readers with parent set to <code>null</code> * Creates a {@link CompositeReaderContext} for top-level readers with parent set to <code>null</code>
*/ */
public CompositeReaderContext(CompositeIndexReader reader, ReaderContext[] children, AtomicReaderContext[] leaves) { public CompositeReaderContext(CompositeReader reader, ReaderContext[] children, AtomicReaderContext[] leaves) {
this(null, reader, 0, 0, children, leaves); this(null, reader, 0, 0, children, leaves);
} }
private CompositeReaderContext(CompositeReaderContext parent, CompositeIndexReader reader, private CompositeReaderContext(CompositeReaderContext parent, CompositeReader reader,
int ordInParent, int docbaseInParent, ReaderContext[] children, int ordInParent, int docbaseInParent, ReaderContext[] children,
AtomicReaderContext[] leaves) { AtomicReaderContext[] leaves) {
super(parent, ordInParent, docbaseInParent); super(parent, ordInParent, docbaseInParent);
@ -158,7 +144,7 @@ public abstract class CompositeIndexReader extends IndexReader {
} }
@Override @Override
public CompositeIndexReader reader() { public CompositeReader reader() {
return reader; return reader;
} }
} }

View File

@ -147,19 +147,19 @@ public class DocTermOrds {
} }
/** Inverts all terms */ /** Inverts all terms */
public DocTermOrds(AtomicIndexReader reader, String field) throws IOException { public DocTermOrds(AtomicReader reader, String field) throws IOException {
this(reader, field, null, Integer.MAX_VALUE); this(reader, field, null, Integer.MAX_VALUE);
} }
/** Inverts only terms starting w/ prefix */ /** Inverts only terms starting w/ prefix */
public DocTermOrds(AtomicIndexReader reader, String field, BytesRef termPrefix) throws IOException { public DocTermOrds(AtomicReader reader, String field, BytesRef termPrefix) throws IOException {
this(reader, field, termPrefix, Integer.MAX_VALUE); this(reader, field, termPrefix, Integer.MAX_VALUE);
} }
/** Inverts only terms starting w/ prefix, and only terms /** Inverts only terms starting w/ prefix, and only terms
* whose docFreq (not taking deletions into account) is * whose docFreq (not taking deletions into account) is
* <= maxTermDocFreq */ * <= maxTermDocFreq */
public DocTermOrds(AtomicIndexReader reader, String field, BytesRef termPrefix, int maxTermDocFreq) throws IOException { public DocTermOrds(AtomicReader reader, String field, BytesRef termPrefix, int maxTermDocFreq) throws IOException {
this(reader, field, termPrefix, maxTermDocFreq, DEFAULT_INDEX_INTERVAL_BITS); this(reader, field, termPrefix, maxTermDocFreq, DEFAULT_INDEX_INTERVAL_BITS);
uninvert(reader, termPrefix); uninvert(reader, termPrefix);
} }
@ -168,7 +168,7 @@ public class DocTermOrds {
* whose docFreq (not taking deletions into account) is * whose docFreq (not taking deletions into account) is
* <= maxTermDocFreq, with a custom indexing interval * <= maxTermDocFreq, with a custom indexing interval
* (default is every 128nd term). */ * (default is every 128nd term). */
public DocTermOrds(AtomicIndexReader reader, String field, BytesRef termPrefix, int maxTermDocFreq, int indexIntervalBits) throws IOException { public DocTermOrds(AtomicReader reader, String field, BytesRef termPrefix, int maxTermDocFreq, int indexIntervalBits) throws IOException {
this(field, maxTermDocFreq, indexIntervalBits); this(field, maxTermDocFreq, indexIntervalBits);
uninvert(reader, termPrefix); uninvert(reader, termPrefix);
} }
@ -194,7 +194,7 @@ public class DocTermOrds {
* *
* <p><b>NOTE</b>: you must pass the same reader that was * <p><b>NOTE</b>: you must pass the same reader that was
* used when creating this class */ * used when creating this class */
public TermsEnum getOrdTermsEnum(AtomicIndexReader reader) throws IOException { public TermsEnum getOrdTermsEnum(AtomicReader reader) throws IOException {
if (termInstances == 0) { if (termInstances == 0) {
return null; return null;
} }
@ -224,7 +224,7 @@ public class DocTermOrds {
} }
// Call this only once (if you subclass!) // Call this only once (if you subclass!)
protected void uninvert(final AtomicIndexReader reader, final BytesRef termPrefix) throws IOException { protected void uninvert(final AtomicReader reader, final BytesRef termPrefix) throws IOException {
//System.out.println("DTO uninvert field=" + field + " prefix=" + termPrefix); //System.out.println("DTO uninvert field=" + field + " prefix=" + termPrefix);
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
prefix = termPrefix == null ? null : BytesRef.deepCopyOf(termPrefix); prefix = termPrefix == null ? null : BytesRef.deepCopyOf(termPrefix);
@ -642,12 +642,12 @@ public class DocTermOrds {
* ord; in this case we "wrap" our own terms index * ord; in this case we "wrap" our own terms index
* around it. */ * around it. */
private final class OrdWrappedTermsEnum extends TermsEnum { private final class OrdWrappedTermsEnum extends TermsEnum {
private final AtomicIndexReader reader; private final AtomicReader reader;
private final TermsEnum termsEnum; private final TermsEnum termsEnum;
private BytesRef term; private BytesRef term;
private long ord = -indexInterval-1; // force "real" seek private long ord = -indexInterval-1; // force "real" seek
public OrdWrappedTermsEnum(AtomicIndexReader reader) throws IOException { public OrdWrappedTermsEnum(AtomicReader reader) throws IOException {
this.reader = reader; this.reader = reader;
assert indexedTermsArray != null; assert indexedTermsArray != null;
termsEnum = reader.fields().terms(field).iterator(null); termsEnum = reader.fields().terms(field).iterator(null);

View File

@ -32,7 +32,7 @@ import java.util.Comparator;
* 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 AtomicIndexReader { public class FilterIndexReader extends AtomicReader {
/** Base class for filtering {@link Fields} /** Base class for filtering {@link Fields}
* implementations. */ * implementations. */
@ -272,14 +272,14 @@ public class FilterIndexReader extends AtomicIndexReader {
} }
} }
protected AtomicIndexReader in; protected AtomicReader in;
/** /**
* <p>Construct a FilterIndexReader based on the specified base reader. * <p>Construct a FilterIndexReader based on the specified base reader.
* <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(AtomicIndexReader in) { public FilterIndexReader(AtomicReader in) {
super(); super();
this.in = in; this.in = in;
} }

View File

@ -21,13 +21,11 @@ import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.lucene.index.CompositeIndexReader.CompositeReaderContext; import org.apache.lucene.index.CompositeReader.CompositeReaderContext;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.document.DocumentStoredFieldVisitor; import org.apache.lucene.document.DocumentStoredFieldVisitor;
import org.apache.lucene.search.SearcherManager; // javadocs import org.apache.lucene.search.SearcherManager; // javadocs

View File

@ -3954,7 +3954,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
* <p><b>NOTE</b>: warm is called before any deletes have * <p><b>NOTE</b>: warm is called before any deletes have
* been carried over to the merged segment. */ * been carried over to the merged segment. */
public static abstract class IndexReaderWarmer { public static abstract class IndexReaderWarmer {
public abstract void warm(AtomicIndexReader reader) throws IOException; public abstract void warm(AtomicReader reader) throws IOException;
} }
private void handleOOM(OutOfMemoryError oom, String location) { private void handleOOM(OutOfMemoryError oom, String location) {

View File

@ -31,10 +31,10 @@ import org.apache.lucene.util.InfoStream;
public class MergeState { public class MergeState {
public static class IndexReaderAndLiveDocs { public static class IndexReaderAndLiveDocs {
public final AtomicIndexReader reader; public final AtomicReader reader;
public final Bits liveDocs; public final Bits liveDocs;
public IndexReaderAndLiveDocs(AtomicIndexReader reader, Bits liveDocs) { public IndexReaderAndLiveDocs(AtomicReader reader, Bits liveDocs) {
this.reader = reader; this.reader = reader;
this.liveDocs = liveDocs; this.liveDocs = liveDocs;
} }

View File

@ -43,11 +43,11 @@ public class MultiDocValues extends DocValues {
private static DocValuesPuller DEFAULT_PULLER = new DocValuesPuller(); private static DocValuesPuller DEFAULT_PULLER = new DocValuesPuller();
private static final DocValuesPuller NORMS_PULLER = new DocValuesPuller() { private static final DocValuesPuller NORMS_PULLER = new DocValuesPuller() {
public DocValues pull(AtomicIndexReader reader, String field) throws IOException { public DocValues pull(AtomicReader reader, String field) throws IOException {
return reader.normValues(field); return reader.normValues(field);
} }
public boolean stopLoadingOnNull(AtomicIndexReader reader, String field) throws IOException { public boolean stopLoadingOnNull(AtomicReader reader, String field) throws IOException {
// for norms we drop all norms if one leaf reader has no norms and the field is present // for norms we drop all norms if one leaf reader has no norms and the field is present
FieldInfos fieldInfos = reader.getFieldInfos(); FieldInfos fieldInfos = reader.getFieldInfos();
FieldInfo fieldInfo = fieldInfos.fieldInfo(field); FieldInfo fieldInfo = fieldInfos.fieldInfo(field);
@ -69,11 +69,11 @@ public class MultiDocValues extends DocValues {
} }
private static class DocValuesPuller { private static class DocValuesPuller {
public DocValues pull(AtomicIndexReader reader, String field) throws IOException { public DocValues pull(AtomicReader reader, String field) throws IOException {
return reader.docValues(field); return reader.docValues(field);
} }
public boolean stopLoadingOnNull(AtomicIndexReader reader, String field) throws IOException { public boolean stopLoadingOnNull(AtomicReader reader, String field) throws IOException {
return false; return false;
} }
} }
@ -115,12 +115,12 @@ public class MultiDocValues extends DocValues {
private static DocValues getDocValues(IndexReader r, final String field, final DocValuesPuller puller) throws IOException { private static DocValues getDocValues(IndexReader r, final String field, final DocValuesPuller puller) throws IOException {
if (r instanceof AtomicIndexReader) { if (r instanceof AtomicReader) {
// already an atomic reader // already an atomic reader
return puller.pull((AtomicIndexReader) r, field); return puller.pull((AtomicReader) r, field);
} }
assert r instanceof CompositeIndexReader; assert r instanceof CompositeReader;
final IndexReader[] subs = ((CompositeIndexReader) r).getSequentialSubReaders(); final IndexReader[] subs = ((CompositeReader) r).getSequentialSubReaders();
if (subs.length == 0) { if (subs.length == 0) {
// no fields // no fields
return null; return null;
@ -138,7 +138,7 @@ public class MultiDocValues extends DocValues {
new ReaderUtil.Gather(r) { new ReaderUtil.Gather(r) {
boolean stop = false; boolean stop = false;
@Override @Override
protected void add(int base, AtomicIndexReader r) throws IOException { protected void add(int base, AtomicReader r) throws IOException {
if (stop) { if (stop) {
return; return;
} }

View File

@ -61,12 +61,12 @@ public final class MultiFields extends Fields {
* Gather}) and iterate through them * Gather}) and iterate through them
* yourself. */ * yourself. */
public static Fields getFields(IndexReader r) throws IOException { public static Fields getFields(IndexReader r) throws IOException {
if (r instanceof AtomicIndexReader) { if (r instanceof AtomicReader) {
// already an atomic reader // already an atomic reader
return ((AtomicIndexReader) r).fields(); return ((AtomicReader) r).fields();
} }
assert r instanceof CompositeIndexReader; assert r instanceof CompositeReader;
final IndexReader[] subs = ((CompositeIndexReader) r).getSequentialSubReaders(); final IndexReader[] subs = ((CompositeReader) r).getSequentialSubReaders();
if (subs.length == 0) { if (subs.length == 0) {
// no fields // no fields
return null; return null;
@ -76,7 +76,7 @@ public final class MultiFields extends Fields {
new ReaderUtil.Gather(r) { new ReaderUtil.Gather(r) {
@Override @Override
protected void add(int base, AtomicIndexReader r) throws IOException { protected void add(int base, AtomicReader r) throws IOException {
final Fields f = r.fields(); final Fields f = r.fields();
if (f != null) { if (f != null) {
fields.add(f); fields.add(f);
@ -104,7 +104,7 @@ public final class MultiFields extends Fields {
try { try {
final int maxDoc = new ReaderUtil.Gather(r) { final int maxDoc = new ReaderUtil.Gather(r) {
@Override @Override
protected void add(int base, AtomicIndexReader r) throws IOException { protected void add(int base, AtomicReader r) throws IOException {
// record all liveDocs, even if they are null // record all liveDocs, even if they are null
liveDocs.add(r.getLiveDocs()); liveDocs.add(r.getLiveDocs());
starts.add(base); starts.add(base);
@ -246,10 +246,10 @@ public final class MultiFields extends Fields {
/** Call this to get the (merged) FieldInfos for a /** Call this to get the (merged) FieldInfos for a
* composite reader */ * composite reader */
public static FieldInfos getMergedFieldInfos(IndexReader reader) { public static FieldInfos getMergedFieldInfos(IndexReader reader) {
final List<AtomicIndexReader> subReaders = new ArrayList<AtomicIndexReader>(); final List<AtomicReader> subReaders = new ArrayList<AtomicReader>();
ReaderUtil.gatherSubReaders(subReaders, reader); ReaderUtil.gatherSubReaders(subReaders, reader);
final FieldInfos fieldInfos = new FieldInfos(); final FieldInfos fieldInfos = new FieldInfos();
for(AtomicIndexReader subReader : subReaders) { for(AtomicReader subReader : subReaders) {
fieldInfos.add(subReader.getFieldInfos()); fieldInfos.add(subReader.getFieldInfos());
} }
return fieldInfos; return fieldInfos;

View File

@ -41,13 +41,13 @@ import org.apache.lucene.util.BytesRef;
* same order to the other indexes. <em>Failure to do so will result in * same order to the other indexes. <em>Failure to do so will result in
* undefined behavior</em>. * undefined behavior</em>.
*/ */
public class ParallelReader extends AtomicIndexReader { public class ParallelReader extends AtomicReader {
private List<AtomicIndexReader> readers = new ArrayList<AtomicIndexReader>(); private List<AtomicReader> readers = new ArrayList<AtomicReader>();
private List<Boolean> decrefOnClose = new ArrayList<Boolean>(); // remember which subreaders to decRef on close private List<Boolean> decrefOnClose = new ArrayList<Boolean>(); // remember which subreaders to decRef on close
boolean incRefReaders = false; boolean incRefReaders = false;
private SortedMap<String,AtomicIndexReader> fieldToReader = new TreeMap<String,AtomicIndexReader>(); private SortedMap<String,AtomicReader> fieldToReader = new TreeMap<String,AtomicReader>();
private Map<AtomicIndexReader,Collection<String>> readerToFields = new HashMap<AtomicIndexReader,Collection<String>>(); private Map<AtomicReader,Collection<String>> readerToFields = new HashMap<AtomicReader,Collection<String>>();
private List<AtomicIndexReader> storedFieldReaders = new ArrayList<AtomicIndexReader>(); private List<AtomicReader> storedFieldReaders = new ArrayList<AtomicReader>();
private Map<String, DocValues> normsCache = new HashMap<String,DocValues>(); private Map<String, DocValues> normsCache = new HashMap<String,DocValues>();
private int maxDoc; private int maxDoc;
private int numDocs; private int numDocs;
@ -75,7 +75,7 @@ public class ParallelReader extends AtomicIndexReader {
@Override @Override
public String toString() { public String toString() {
final StringBuilder buffer = new StringBuilder("ParallelReader("); final StringBuilder buffer = new StringBuilder("ParallelReader(");
final Iterator<AtomicIndexReader> iter = readers.iterator(); final Iterator<AtomicReader> iter = readers.iterator();
if (iter.hasNext()) { if (iter.hasNext()) {
buffer.append(iter.next()); buffer.append(iter.next());
} }
@ -89,7 +89,7 @@ public class ParallelReader extends AtomicIndexReader {
/** Add an AtomicIndexReader. /** Add an AtomicIndexReader.
* @throws IOException if there is a low-level IO error * @throws IOException if there is a low-level IO error
*/ */
public void add(AtomicIndexReader reader) throws IOException { public void add(AtomicReader reader) throws IOException {
ensureOpen(); ensureOpen();
add(reader, false); add(reader, false);
} }
@ -101,10 +101,10 @@ public class ParallelReader extends AtomicIndexReader {
* @throws IllegalArgumentException if not all indexes contain the same number * @throws IllegalArgumentException if not all indexes contain the same number
* of documents * of documents
* @throws IllegalArgumentException if not all indexes have the same value * @throws IllegalArgumentException if not all indexes have the same value
* of {@link AtomicIndexReader#maxDoc()} * of {@link AtomicReader#maxDoc()}
* @throws IOException if there is a low-level IO error * @throws IOException if there is a low-level IO error
*/ */
public void add(AtomicIndexReader reader, boolean ignoreStoredFields) public void add(AtomicReader reader, boolean ignoreStoredFields)
throws IOException { throws IOException {
ensureOpen(); ensureOpen();
@ -233,7 +233,7 @@ public class ParallelReader extends AtomicIndexReader {
@Override @Override
public void document(int docID, StoredFieldVisitor visitor) throws CorruptIndexException, IOException { public void document(int docID, StoredFieldVisitor visitor) throws CorruptIndexException, IOException {
ensureOpen(); ensureOpen();
for (final AtomicIndexReader reader: storedFieldReaders) { for (final AtomicReader reader: storedFieldReaders) {
reader.document(docID, visitor); reader.document(docID, visitor);
} }
} }
@ -243,7 +243,7 @@ public class ParallelReader extends AtomicIndexReader {
public Fields getTermVectors(int docID) throws IOException { public Fields getTermVectors(int docID) throws IOException {
ensureOpen(); ensureOpen();
ParallelFields fields = new ParallelFields(); ParallelFields fields = new ParallelFields();
for (Map.Entry<String,AtomicIndexReader> ent : fieldToReader.entrySet()) { for (Map.Entry<String,AtomicReader> ent : fieldToReader.entrySet()) {
String fieldName = ent.getKey(); String fieldName = ent.getKey();
Terms vector = ent.getValue().getTermVector(docID, fieldName); Terms vector = ent.getValue().getTermVector(docID, fieldName);
if (vector != null) { if (vector != null) {
@ -257,20 +257,20 @@ public class ParallelReader extends AtomicIndexReader {
@Override @Override
public boolean hasNorms(String field) throws IOException { public boolean hasNorms(String field) throws IOException {
ensureOpen(); ensureOpen();
AtomicIndexReader reader = fieldToReader.get(field); AtomicReader reader = fieldToReader.get(field);
return reader==null ? false : reader.hasNorms(field); return reader==null ? false : reader.hasNorms(field);
} }
@Override @Override
public int docFreq(String field, BytesRef term) throws IOException { public int docFreq(String field, BytesRef term) throws IOException {
ensureOpen(); ensureOpen();
AtomicIndexReader reader = fieldToReader.get(field); AtomicReader reader = fieldToReader.get(field);
return reader == null? 0 : reader.docFreq(field, term); return reader == null? 0 : reader.docFreq(field, term);
} }
// for testing // for testing
AtomicIndexReader[] getSubReaders() { AtomicReader[] getSubReaders() {
return readers.toArray(new AtomicIndexReader[readers.size()]); return readers.toArray(new AtomicReader[readers.size()]);
} }
@Override @Override
@ -287,7 +287,7 @@ public class ParallelReader extends AtomicIndexReader {
// TODO: I suspect this is completely untested!!!!! // TODO: I suspect this is completely untested!!!!!
@Override @Override
public DocValues docValues(String field) throws IOException { public DocValues docValues(String field) throws IOException {
AtomicIndexReader reader = fieldToReader.get(field); AtomicReader reader = fieldToReader.get(field);
return reader == null ? null : reader.docValues(field); return reader == null ? null : reader.docValues(field);
} }
@ -296,7 +296,7 @@ public class ParallelReader extends AtomicIndexReader {
public synchronized DocValues normValues(String field) throws IOException { public synchronized DocValues normValues(String field) throws IOException {
DocValues values = normsCache.get(field); DocValues values = normsCache.get(field);
if (values == null) { if (values == null) {
AtomicIndexReader reader = fieldToReader.get(field); AtomicReader reader = fieldToReader.get(field);
values = reader == null ? null : reader.normValues(field); values = reader == null ? null : reader.normValues(field);
normsCache.put(field, values); normsCache.put(field, values);
} }

View File

@ -76,7 +76,7 @@ final class SegmentMerger {
try { try {
new ReaderUtil.Gather(reader) { new ReaderUtil.Gather(reader) {
@Override @Override
protected void add(int base, AtomicIndexReader r) { protected void add(int base, AtomicReader r) {
mergeState.readers.add(new MergeState.IndexReaderAndLiveDocs(r, r.getLiveDocs())); mergeState.readers.add(new MergeState.IndexReaderAndLiveDocs(r, r.getLiveDocs()));
} }
}.run(); }.run();
@ -201,7 +201,7 @@ final class SegmentMerger {
Map<FieldInfo,TypePromoter> normValuesTypes = new HashMap<FieldInfo,TypePromoter>(); Map<FieldInfo,TypePromoter> normValuesTypes = new HashMap<FieldInfo,TypePromoter>();
for (MergeState.IndexReaderAndLiveDocs readerAndLiveDocs : mergeState.readers) { for (MergeState.IndexReaderAndLiveDocs readerAndLiveDocs : mergeState.readers) {
final AtomicIndexReader reader = readerAndLiveDocs.reader; final AtomicReader reader = readerAndLiveDocs.reader;
FieldInfos readerFieldInfos = reader.getFieldInfos(); FieldInfos readerFieldInfos = reader.getFieldInfos();
for (FieldInfo fi : readerFieldInfos) { for (FieldInfo fi : readerFieldInfos) {
FieldInfo merged = mergeState.fieldInfos.add(fi); FieldInfo merged = mergeState.fieldInfos.add(fi);

View File

@ -30,7 +30,7 @@ import org.apache.lucene.util.Bits;
/** /**
* @lucene.experimental * @lucene.experimental
*/ */
public final class SegmentReader extends AtomicIndexReader { public final class SegmentReader extends AtomicReader {
private final SegmentInfo si; private final SegmentInfo si;
private final Bits liveDocs; private final Bits liveDocs;

View File

@ -50,27 +50,27 @@ import org.apache.lucene.index.MultiReader; // javadoc
* yourself.</p> * yourself.</p>
*/ */
public final class SlowCompositeReaderWrapper extends AtomicIndexReader { public final class SlowCompositeReaderWrapper extends AtomicReader {
private final CompositeIndexReader in; private final CompositeReader in;
private final Map<String, DocValues> normsCache = new HashMap<String, DocValues>(); private final Map<String, DocValues> normsCache = new HashMap<String, DocValues>();
private final Fields fields; private final Fields fields;
private final Bits liveDocs; private final Bits liveDocs;
/** This method is sugar for getting an {@link AtomicIndexReader} from /** This method is sugar for getting an {@link AtomicReader} from
* an {@link IndexReader} of any kind. If the reader is already atomic, * an {@link IndexReader} of any kind. If the reader is already atomic,
* it is returned unchanged, otherwise wrapped by this class. * it is returned unchanged, otherwise wrapped by this class.
*/ */
public static AtomicIndexReader wrap(IndexReader reader) throws IOException { public static AtomicReader wrap(IndexReader reader) throws IOException {
if (reader instanceof CompositeIndexReader) { if (reader instanceof CompositeReader) {
return new SlowCompositeReaderWrapper((CompositeIndexReader) reader); return new SlowCompositeReaderWrapper((CompositeReader) reader);
} else { } else {
assert reader instanceof AtomicIndexReader; assert reader instanceof AtomicReader;
return (AtomicIndexReader) reader; return (AtomicReader) reader;
} }
} }
public SlowCompositeReaderWrapper(CompositeIndexReader reader) throws IOException { public SlowCompositeReaderWrapper(CompositeReader reader) throws IOException {
super(); super();
in = reader; in = reader;
fields = MultiFields.getFields(in); fields = MultiFields.getFields(in);

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import java.util.*; import java.util.*;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum; import org.apache.lucene.index.TermsEnum;

View File

@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery.BooleanWeight; import org.apache.lucene.search.BooleanQuery.BooleanWeight;

View File

@ -17,7 +17,7 @@ package org.apache.lucene.search;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.RamUsageEstimator; import org.apache.lucene.util.RamUsageEstimator;
import java.io.IOException; import java.io.IOException;

View File

@ -22,8 +22,8 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
@ -76,7 +76,7 @@ public class CachingWrapperFilter extends Filter {
* returns <code>true</code>, else it copies the {@link DocIdSetIterator} into * returns <code>true</code>, else it copies the {@link DocIdSetIterator} into
* a {@link FixedBitSet}. * a {@link FixedBitSet}.
*/ */
protected DocIdSet docIdSetToCache(DocIdSet docIdSet, AtomicIndexReader reader) throws IOException { protected DocIdSet docIdSetToCache(DocIdSet docIdSet, AtomicReader reader) throws IOException {
if (docIdSet == null) { if (docIdSet == null) {
// this is better than returning null, as the nonnull result can be cached // this is better than returning null, as the nonnull result can be cached
return DocIdSet.EMPTY_DOCIDSET; return DocIdSet.EMPTY_DOCIDSET;
@ -102,7 +102,7 @@ public class CachingWrapperFilter extends Filter {
@Override @Override
public DocIdSet getDocIdSet(AtomicReaderContext context, final Bits acceptDocs) throws IOException { public DocIdSet getDocIdSet(AtomicReaderContext context, final Bits acceptDocs) throws IOException {
final AtomicIndexReader reader = context.reader(); final AtomicReader reader = context.reader();
// Only cache if incoming acceptDocs is == live docs; // Only cache if incoming acceptDocs is == live docs;
// if Lucene passes in more interesting acceptDocs in // if Lucene passes in more interesting acceptDocs in

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
/** /**

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search;
*/ */
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.ToStringUtils; import org.apache.lucene.util.ToStringUtils;

View File

@ -23,7 +23,7 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -24,7 +24,7 @@ import java.text.DecimalFormat;
import org.apache.lucene.analysis.NumericTokenStream; // for javadocs import org.apache.lucene.analysis.NumericTokenStream; // for javadocs
import org.apache.lucene.document.NumericField; // for javadocs import org.apache.lucene.document.NumericField; // for javadocs
import org.apache.lucene.index.DocTermOrds; import org.apache.lucene.index.DocTermOrds;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.TermsEnum; import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
@ -63,7 +63,7 @@ public interface FieldCache {
} }
/** Interface to parse bytes from document fields. /** Interface to parse bytes from document fields.
* @see FieldCache#getBytes(AtomicIndexReader, String, FieldCache.ByteParser, boolean) * @see FieldCache#getBytes(AtomicReader, String, FieldCache.ByteParser, boolean)
*/ */
public interface ByteParser extends Parser { public interface ByteParser extends Parser {
/** Return a single Byte representation of this field's value. */ /** Return a single Byte representation of this field's value. */
@ -71,7 +71,7 @@ public interface FieldCache {
} }
/** Interface to parse shorts from document fields. /** Interface to parse shorts from document fields.
* @see FieldCache#getShorts(AtomicIndexReader, String, FieldCache.ShortParser, boolean) * @see FieldCache#getShorts(AtomicReader, String, FieldCache.ShortParser, boolean)
*/ */
public interface ShortParser extends Parser { public interface ShortParser extends Parser {
/** Return a short representation of this field's value. */ /** Return a short representation of this field's value. */
@ -79,7 +79,7 @@ public interface FieldCache {
} }
/** Interface to parse ints from document fields. /** Interface to parse ints from document fields.
* @see FieldCache#getInts(AtomicIndexReader, String, FieldCache.IntParser, boolean) * @see FieldCache#getInts(AtomicReader, String, FieldCache.IntParser, boolean)
*/ */
public interface IntParser extends Parser { public interface IntParser extends Parser {
/** Return an integer representation of this field's value. */ /** Return an integer representation of this field's value. */
@ -87,7 +87,7 @@ public interface FieldCache {
} }
/** Interface to parse floats from document fields. /** Interface to parse floats from document fields.
* @see FieldCache#getFloats(AtomicIndexReader, String, FieldCache.FloatParser, boolean) * @see FieldCache#getFloats(AtomicReader, String, FieldCache.FloatParser, boolean)
*/ */
public interface FloatParser extends Parser { public interface FloatParser extends Parser {
/** Return an float representation of this field's value. */ /** Return an float representation of this field's value. */
@ -95,7 +95,7 @@ public interface FieldCache {
} }
/** Interface to parse long from document fields. /** Interface to parse long from document fields.
* @see FieldCache#getLongs(AtomicIndexReader, String, FieldCache.LongParser, boolean) * @see FieldCache#getLongs(AtomicReader, String, FieldCache.LongParser, boolean)
*/ */
public interface LongParser extends Parser { public interface LongParser extends Parser {
/** Return an long representation of this field's value. */ /** Return an long representation of this field's value. */
@ -103,7 +103,7 @@ public interface FieldCache {
} }
/** Interface to parse doubles from document fields. /** Interface to parse doubles from document fields.
* @see FieldCache#getDoubles(AtomicIndexReader, String, FieldCache.DoubleParser, boolean) * @see FieldCache#getDoubles(AtomicReader, String, FieldCache.DoubleParser, boolean)
*/ */
public interface DoubleParser extends Parser { public interface DoubleParser extends Parser {
/** Return an long representation of this field's value. */ /** Return an long representation of this field's value. */
@ -303,7 +303,7 @@ public interface FieldCache {
* <code>reader.maxDoc()</code>, with turned on bits for each docid that * <code>reader.maxDoc()</code>, with turned on bits for each docid that
* does have a value for this field. * does have a value for this field.
*/ */
public Bits getDocsWithField(AtomicIndexReader reader, String field) public Bits getDocsWithField(AtomicReader reader, String field)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if none is /** Checks the internal cache for an appropriate entry, and if none is
@ -317,7 +317,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public byte[] getBytes (AtomicIndexReader reader, String field, boolean setDocsWithField) public byte[] getBytes (AtomicReader reader, String field, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if none is found, /** Checks the internal cache for an appropriate entry, and if none is found,
@ -332,7 +332,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public byte[] getBytes (AtomicIndexReader reader, String field, ByteParser parser, boolean setDocsWithField) public byte[] getBytes (AtomicReader reader, String field, ByteParser parser, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if none is /** Checks the internal cache for an appropriate entry, and if none is
@ -346,7 +346,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public short[] getShorts (AtomicIndexReader reader, String field, boolean setDocsWithField) public short[] getShorts (AtomicReader reader, String field, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if none is found, /** Checks the internal cache for an appropriate entry, and if none is found,
@ -361,7 +361,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public short[] getShorts (AtomicIndexReader reader, String field, ShortParser parser, boolean setDocsWithField) public short[] getShorts (AtomicReader reader, String field, ShortParser parser, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if none is /** Checks the internal cache for an appropriate entry, and if none is
@ -375,7 +375,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public int[] getInts (AtomicIndexReader reader, String field, boolean setDocsWithField) public int[] getInts (AtomicReader reader, String field, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if none is found, /** Checks the internal cache for an appropriate entry, and if none is found,
@ -390,7 +390,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public int[] getInts (AtomicIndexReader reader, String field, IntParser parser, boolean setDocsWithField) public int[] getInts (AtomicReader reader, String field, IntParser parser, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if /** Checks the internal cache for an appropriate entry, and if
@ -404,7 +404,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public float[] getFloats (AtomicIndexReader reader, String field, boolean setDocsWithField) public float[] getFloats (AtomicReader reader, String field, boolean setDocsWithField)
throws IOException; throws IOException;
/** Checks the internal cache for an appropriate entry, and if /** Checks the internal cache for an appropriate entry, and if
@ -419,7 +419,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public float[] getFloats (AtomicIndexReader reader, String field, public float[] getFloats (AtomicReader reader, String field,
FloatParser parser, boolean setDocsWithField) throws IOException; FloatParser parser, boolean setDocsWithField) throws IOException;
/** /**
@ -435,7 +435,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws java.io.IOException If any error occurs. * @throws java.io.IOException If any error occurs.
*/ */
public long[] getLongs(AtomicIndexReader reader, String field, boolean setDocsWithField) public long[] getLongs(AtomicReader reader, String field, boolean setDocsWithField)
throws IOException; throws IOException;
/** /**
@ -452,7 +452,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public long[] getLongs(AtomicIndexReader reader, String field, LongParser parser, boolean setDocsWithField) public long[] getLongs(AtomicReader reader, String field, LongParser parser, boolean setDocsWithField)
throws IOException; throws IOException;
/** /**
@ -468,7 +468,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public double[] getDoubles(AtomicIndexReader reader, String field, boolean setDocsWithField) public double[] getDoubles(AtomicReader reader, String field, boolean setDocsWithField)
throws IOException; throws IOException;
/** /**
@ -485,7 +485,7 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public double[] getDoubles(AtomicIndexReader reader, String field, DoubleParser parser, boolean setDocsWithField) public double[] getDoubles(AtomicReader reader, String field, DoubleParser parser, boolean setDocsWithField)
throws IOException; throws IOException;
/** Returned by {@link #getTerms} */ /** Returned by {@link #getTerms} */
@ -513,15 +513,15 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public DocTerms getTerms (AtomicIndexReader reader, String field) public DocTerms getTerms (AtomicReader reader, String field)
throws IOException; throws IOException;
/** Expert: just like {@link #getTerms(AtomicIndexReader,String)}, /** Expert: just like {@link #getTerms(AtomicReader,String)},
* but you can specify whether more RAM should be consumed in exchange for * but you can specify whether more RAM should be consumed in exchange for
* faster lookups (default is "true"). Note that the * faster lookups (default is "true"). Note that the
* first call for a given reader and field "wins", * first call for a given reader and field "wins",
* subsequent calls will share the same cache entry. */ * subsequent calls will share the same cache entry. */
public DocTerms getTerms (AtomicIndexReader reader, String field, boolean fasterButMoreRAM) public DocTerms getTerms (AtomicReader reader, String field, boolean fasterButMoreRAM)
throws IOException; throws IOException;
/** Returned by {@link #getTermsIndex} */ /** Returned by {@link #getTermsIndex} */
@ -589,16 +589,16 @@ public interface FieldCache {
* @return The values in the given field for each document. * @return The values in the given field for each document.
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public DocTermsIndex getTermsIndex (AtomicIndexReader reader, String field) public DocTermsIndex getTermsIndex (AtomicReader reader, String field)
throws IOException; throws IOException;
/** Expert: just like {@link /** Expert: just like {@link
* #getTermsIndex(AtomicIndexReader,String)}, but you can specify * #getTermsIndex(AtomicReader,String)}, but you can specify
* whether more RAM should be consumed in exchange for * whether more RAM should be consumed in exchange for
* faster lookups (default is "true"). Note that the * faster lookups (default is "true"). Note that the
* first call for a given reader and field "wins", * first call for a given reader and field "wins",
* subsequent calls will share the same cache entry. */ * subsequent calls will share the same cache entry. */
public DocTermsIndex getTermsIndex (AtomicIndexReader reader, String field, boolean fasterButMoreRAM) public DocTermsIndex getTermsIndex (AtomicReader reader, String field, boolean fasterButMoreRAM)
throws IOException; throws IOException;
/** /**
@ -611,7 +611,7 @@ public interface FieldCache {
* @return a {@link DocTermOrds} instance * @return a {@link DocTermOrds} instance
* @throws IOException If any error occurs. * @throws IOException If any error occurs.
*/ */
public DocTermOrds getDocTermOrds(AtomicIndexReader reader, String field) throws IOException; public DocTermOrds getDocTermOrds(AtomicReader reader, String field) throws IOException;
/** /**
* EXPERT: A unique Identifier/Description for each item in the FieldCache. * EXPERT: A unique Identifier/Description for each item in the FieldCache.
@ -705,7 +705,7 @@ public interface FieldCache {
* top-level reader, it usually will have no effect as * top-level reader, it usually will have no effect as
* Lucene now caches at the segment reader level. * Lucene now caches at the segment reader level.
*/ */
public abstract void purge(AtomicIndexReader r); public abstract void purge(AtomicReader r);
/** /**
* If non-null, FieldCacheImpl will warn whenever * If non-null, FieldCacheImpl will warn whenever

View File

@ -29,7 +29,7 @@ import java.util.WeakHashMap;
import org.apache.lucene.index.DocTermOrds; import org.apache.lucene.index.DocTermOrds;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.OrdTermState; import org.apache.lucene.index.OrdTermState;
import org.apache.lucene.index.SegmentReader; import org.apache.lucene.index.SegmentReader;
@ -75,7 +75,7 @@ class FieldCacheImpl implements FieldCache {
init(); init();
} }
public synchronized void purge(AtomicIndexReader r) { public synchronized void purge(AtomicReader r) {
for(Cache c : caches.values()) { for(Cache c : caches.values()) {
c.purge(r); c.purge(r);
} }
@ -154,23 +154,23 @@ class FieldCacheImpl implements FieldCache {
}; };
// composite/SlowMultiReaderWrapper fieldcaches don't purge until composite reader is closed. // composite/SlowMultiReaderWrapper fieldcaches don't purge until composite reader is closed.
final AtomicIndexReader.ReaderClosedListener purgeReader = new AtomicIndexReader.ReaderClosedListener() { final IndexReader.ReaderClosedListener purgeReader = new IndexReader.ReaderClosedListener() {
@Override @Override
public void onClose(IndexReader owner) { public void onClose(IndexReader owner) {
assert owner instanceof AtomicIndexReader; assert owner instanceof AtomicReader;
FieldCacheImpl.this.purge((AtomicIndexReader) owner); FieldCacheImpl.this.purge((AtomicReader) owner);
} }
}; };
private void initReader(AtomicIndexReader reader) { private void initReader(AtomicReader reader) {
if (reader instanceof SegmentReader) { if (reader instanceof SegmentReader) {
((SegmentReader) reader).addCoreClosedListener(purgeCore); ((SegmentReader) reader).addCoreClosedListener(purgeCore);
} else { } else {
// we have a slow reader of some sort, try to register a purge event // we have a slow reader of some sort, try to register a purge event
// rather than relying on gc: // rather than relying on gc:
Object key = reader.getCoreCacheKey(); Object key = reader.getCoreCacheKey();
if (key instanceof AtomicIndexReader) { if (key instanceof AtomicReader) {
((AtomicIndexReader)key).addReaderClosedListener(purgeReader); ((AtomicReader)key).addReaderClosedListener(purgeReader);
} else { } else {
// last chance // last chance
reader.addReaderClosedListener(purgeReader); reader.addReaderClosedListener(purgeReader);
@ -189,11 +189,11 @@ class FieldCacheImpl implements FieldCache {
final Map<Object,Map<Entry,Object>> readerCache = new WeakHashMap<Object,Map<Entry,Object>>(); final Map<Object,Map<Entry,Object>> readerCache = new WeakHashMap<Object,Map<Entry,Object>>();
protected abstract Object createValue(AtomicIndexReader reader, Entry key, boolean setDocsWithField) protected abstract Object createValue(AtomicReader reader, Entry key, boolean setDocsWithField)
throws IOException; throws IOException;
/** Remove this reader from the cache, if present. */ /** Remove this reader from the cache, if present. */
public void purge(AtomicIndexReader r) { public void purge(AtomicReader r) {
Object readerKey = r.getCoreCacheKey(); Object readerKey = r.getCoreCacheKey();
synchronized(readerCache) { synchronized(readerCache) {
readerCache.remove(readerKey); readerCache.remove(readerKey);
@ -202,7 +202,7 @@ class FieldCacheImpl implements FieldCache {
/** Sets the key to the value for the provided reader; /** Sets the key to the value for the provided reader;
* if the key is already set then this doesn't change it. */ * if the key is already set then this doesn't change it. */
public void put(AtomicIndexReader reader, Entry key, Object value) { public void put(AtomicReader reader, Entry key, Object value) {
final Object readerKey = reader.getCoreCacheKey(); final Object readerKey = reader.getCoreCacheKey();
synchronized (readerCache) { synchronized (readerCache) {
Map<Entry,Object> innerCache = readerCache.get(readerKey); Map<Entry,Object> innerCache = readerCache.get(readerKey);
@ -221,7 +221,7 @@ class FieldCacheImpl implements FieldCache {
} }
} }
public Object get(AtomicIndexReader reader, Entry key, boolean setDocsWithField) throws IOException { public Object get(AtomicReader reader, Entry key, boolean setDocsWithField) throws IOException {
Map<Entry,Object> innerCache; Map<Entry,Object> innerCache;
Object value; Object value;
final Object readerKey = reader.getCoreCacheKey(); final Object readerKey = reader.getCoreCacheKey();
@ -319,12 +319,12 @@ class FieldCacheImpl implements FieldCache {
} }
// inherit javadocs // inherit javadocs
public byte[] getBytes (AtomicIndexReader reader, String field, boolean setDocsWithField) throws IOException { public byte[] getBytes (AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
return getBytes(reader, field, null, setDocsWithField); return getBytes(reader, field, null, setDocsWithField);
} }
// inherit javadocs // inherit javadocs
public byte[] getBytes(AtomicIndexReader reader, String field, ByteParser parser, boolean setDocsWithField) public byte[] getBytes(AtomicReader reader, String field, ByteParser parser, boolean setDocsWithField)
throws IOException { throws IOException {
return (byte[]) caches.get(Byte.TYPE).get(reader, new Entry(field, parser), setDocsWithField); return (byte[]) caches.get(Byte.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
} }
@ -334,7 +334,7 @@ class FieldCacheImpl implements FieldCache {
super(wrapper); super(wrapper);
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
throws IOException { throws IOException {
String field = entryKey.field; String field = entryKey.field;
ByteParser parser = (ByteParser) entryKey.custom; ByteParser parser = (ByteParser) entryKey.custom;
@ -391,12 +391,12 @@ class FieldCacheImpl implements FieldCache {
} }
// inherit javadocs // inherit javadocs
public short[] getShorts (AtomicIndexReader reader, String field, boolean setDocsWithField) throws IOException { public short[] getShorts (AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
return getShorts(reader, field, null, setDocsWithField); return getShorts(reader, field, null, setDocsWithField);
} }
// inherit javadocs // inherit javadocs
public short[] getShorts(AtomicIndexReader reader, String field, ShortParser parser, boolean setDocsWithField) public short[] getShorts(AtomicReader reader, String field, ShortParser parser, boolean setDocsWithField)
throws IOException { throws IOException {
return (short[]) caches.get(Short.TYPE).get(reader, new Entry(field, parser), setDocsWithField); return (short[]) caches.get(Short.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
} }
@ -407,7 +407,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
throws IOException { throws IOException {
String field = entryKey.field; String field = entryKey.field;
ShortParser parser = (ShortParser) entryKey.custom; ShortParser parser = (ShortParser) entryKey.custom;
@ -464,7 +464,7 @@ class FieldCacheImpl implements FieldCache {
} }
// null Bits means no docs matched // null Bits means no docs matched
void setDocsWithField(AtomicIndexReader reader, String field, Bits docsWithField) { void setDocsWithField(AtomicReader reader, String field, Bits docsWithField) {
final int maxDoc = reader.maxDoc(); final int maxDoc = reader.maxDoc();
final Bits bits; final Bits bits;
if (docsWithField == null) { if (docsWithField == null) {
@ -485,12 +485,12 @@ class FieldCacheImpl implements FieldCache {
} }
// inherit javadocs // inherit javadocs
public int[] getInts (AtomicIndexReader reader, String field, boolean setDocsWithField) throws IOException { public int[] getInts (AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
return getInts(reader, field, null, setDocsWithField); return getInts(reader, field, null, setDocsWithField);
} }
// inherit javadocs // inherit javadocs
public int[] getInts(AtomicIndexReader reader, String field, IntParser parser, boolean setDocsWithField) public int[] getInts(AtomicReader reader, String field, IntParser parser, boolean setDocsWithField)
throws IOException { throws IOException {
return (int[]) caches.get(Integer.TYPE).get(reader, new Entry(field, parser), setDocsWithField); return (int[]) caches.get(Integer.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
} }
@ -501,7 +501,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
throws IOException { throws IOException {
String field = entryKey.field; String field = entryKey.field;
IntParser parser = (IntParser) entryKey.custom; IntParser parser = (IntParser) entryKey.custom;
@ -572,7 +572,7 @@ class FieldCacheImpl implements FieldCache {
} }
} }
public Bits getDocsWithField(AtomicIndexReader reader, String field) public Bits getDocsWithField(AtomicReader reader, String field)
throws IOException { throws IOException {
return (Bits) caches.get(DocsWithFieldCache.class).get(reader, new Entry(field, null), false); return (Bits) caches.get(DocsWithFieldCache.class).get(reader, new Entry(field, null), false);
} }
@ -583,7 +583,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
throws IOException { throws IOException {
final String field = entryKey.field; final String field = entryKey.field;
FixedBitSet res = null; FixedBitSet res = null;
@ -633,13 +633,13 @@ class FieldCacheImpl implements FieldCache {
} }
// inherit javadocs // inherit javadocs
public float[] getFloats (AtomicIndexReader reader, String field, boolean setDocsWithField) public float[] getFloats (AtomicReader reader, String field, boolean setDocsWithField)
throws IOException { throws IOException {
return getFloats(reader, field, null, setDocsWithField); return getFloats(reader, field, null, setDocsWithField);
} }
// inherit javadocs // inherit javadocs
public float[] getFloats(AtomicIndexReader reader, String field, FloatParser parser, boolean setDocsWithField) public float[] getFloats(AtomicReader reader, String field, FloatParser parser, boolean setDocsWithField)
throws IOException { throws IOException {
return (float[]) caches.get(Float.TYPE).get(reader, new Entry(field, parser), setDocsWithField); return (float[]) caches.get(Float.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
@ -651,7 +651,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
throws IOException { throws IOException {
String field = entryKey.field; String field = entryKey.field;
FloatParser parser = (FloatParser) entryKey.custom; FloatParser parser = (FloatParser) entryKey.custom;
@ -723,12 +723,12 @@ class FieldCacheImpl implements FieldCache {
} }
public long[] getLongs(AtomicIndexReader reader, String field, boolean setDocsWithField) throws IOException { public long[] getLongs(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
return getLongs(reader, field, null, setDocsWithField); return getLongs(reader, field, null, setDocsWithField);
} }
// inherit javadocs // inherit javadocs
public long[] getLongs(AtomicIndexReader reader, String field, FieldCache.LongParser parser, boolean setDocsWithField) public long[] getLongs(AtomicReader reader, String field, FieldCache.LongParser parser, boolean setDocsWithField)
throws IOException { throws IOException {
return (long[]) caches.get(Long.TYPE).get(reader, new Entry(field, parser), setDocsWithField); return (long[]) caches.get(Long.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
} }
@ -739,7 +739,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
throws IOException { throws IOException {
String field = entryKey.field; String field = entryKey.field;
FieldCache.LongParser parser = (FieldCache.LongParser) entryKey.custom; FieldCache.LongParser parser = (FieldCache.LongParser) entryKey.custom;
@ -811,13 +811,13 @@ class FieldCacheImpl implements FieldCache {
} }
// inherit javadocs // inherit javadocs
public double[] getDoubles(AtomicIndexReader reader, String field, boolean setDocsWithField) public double[] getDoubles(AtomicReader reader, String field, boolean setDocsWithField)
throws IOException { throws IOException {
return getDoubles(reader, field, null, setDocsWithField); return getDoubles(reader, field, null, setDocsWithField);
} }
// inherit javadocs // inherit javadocs
public double[] getDoubles(AtomicIndexReader reader, String field, FieldCache.DoubleParser parser, boolean setDocsWithField) public double[] getDoubles(AtomicReader reader, String field, FieldCache.DoubleParser parser, boolean setDocsWithField)
throws IOException { throws IOException {
return (double[]) caches.get(Double.TYPE).get(reader, new Entry(field, parser), setDocsWithField); return (double[]) caches.get(Double.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
} }
@ -828,7 +828,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
throws IOException { throws IOException {
String field = entryKey.field; String field = entryKey.field;
FieldCache.DoubleParser parser = (FieldCache.DoubleParser) entryKey.custom; FieldCache.DoubleParser parser = (FieldCache.DoubleParser) entryKey.custom;
@ -1073,11 +1073,11 @@ class FieldCacheImpl implements FieldCache {
private static boolean DEFAULT_FASTER_BUT_MORE_RAM = true; private static boolean DEFAULT_FASTER_BUT_MORE_RAM = true;
public DocTermsIndex getTermsIndex(AtomicIndexReader reader, String field) throws IOException { public DocTermsIndex getTermsIndex(AtomicReader reader, String field) throws IOException {
return getTermsIndex(reader, field, DEFAULT_FASTER_BUT_MORE_RAM); return getTermsIndex(reader, field, DEFAULT_FASTER_BUT_MORE_RAM);
} }
public DocTermsIndex getTermsIndex(AtomicIndexReader reader, String field, boolean fasterButMoreRAM) throws IOException { public DocTermsIndex getTermsIndex(AtomicReader reader, String field, boolean fasterButMoreRAM) throws IOException {
return (DocTermsIndex) caches.get(DocTermsIndex.class).get(reader, new Entry(field, Boolean.valueOf(fasterButMoreRAM)), false); return (DocTermsIndex) caches.get(DocTermsIndex.class).get(reader, new Entry(field, Boolean.valueOf(fasterButMoreRAM)), false);
} }
@ -1087,7 +1087,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
throws IOException { throws IOException {
Terms terms = reader.terms(entryKey.field); Terms terms = reader.terms(entryKey.field);
@ -1218,11 +1218,11 @@ class FieldCacheImpl implements FieldCache {
// TODO: this if DocTermsIndex was already created, we // TODO: this if DocTermsIndex was already created, we
// should share it... // should share it...
public DocTerms getTerms(AtomicIndexReader reader, String field) throws IOException { public DocTerms getTerms(AtomicReader reader, String field) throws IOException {
return getTerms(reader, field, DEFAULT_FASTER_BUT_MORE_RAM); return getTerms(reader, field, DEFAULT_FASTER_BUT_MORE_RAM);
} }
public DocTerms getTerms(AtomicIndexReader reader, String field, boolean fasterButMoreRAM) throws IOException { public DocTerms getTerms(AtomicReader reader, String field, boolean fasterButMoreRAM) throws IOException {
return (DocTerms) caches.get(DocTerms.class).get(reader, new Entry(field, Boolean.valueOf(fasterButMoreRAM)), false); return (DocTerms) caches.get(DocTerms.class).get(reader, new Entry(field, Boolean.valueOf(fasterButMoreRAM)), false);
} }
@ -1232,7 +1232,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
throws IOException { throws IOException {
Terms terms = reader.terms(entryKey.field); Terms terms = reader.terms(entryKey.field);
@ -1306,7 +1306,7 @@ class FieldCacheImpl implements FieldCache {
} }
} }
public DocTermOrds getDocTermOrds(AtomicIndexReader reader, String field) throws IOException { public DocTermOrds getDocTermOrds(AtomicReader reader, String field) throws IOException {
return (DocTermOrds) caches.get(DocTermOrds.class).get(reader, new Entry(field, null), false); return (DocTermOrds) caches.get(DocTermOrds.class).get(reader, new Entry(field, null), false);
} }
@ -1316,7 +1316,7 @@ class FieldCacheImpl implements FieldCache {
} }
@Override @Override
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */) protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
throws IOException { throws IOException {
return new DocTermOrds(reader, entryKey.field); return new DocTermOrds(reader, entryKey.field);
} }

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import org.apache.lucene.index.DocsEnum; // javadoc @link import org.apache.lucene.index.DocsEnum; // javadoc @link
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;

View File

@ -20,7 +20,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import java.util.Comparator; import java.util.Comparator;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.FieldCache.ByteParser; import org.apache.lucene.search.FieldCache.ByteParser;

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search;
*/ */
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.Bits.MatchAllBits; import org.apache.lucene.util.Bits.MatchAllBits;
import org.apache.lucene.util.Bits.MatchNoBits; import org.apache.lucene.util.Bits.MatchNoBits;

View File

@ -20,7 +20,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.IndexReader; // javadocs import org.apache.lucene.index.IndexReader; // javadocs
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
/** /**

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search;
*/ */
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.ToStringUtils; import org.apache.lucene.util.ToStringUtils;

View File

@ -32,7 +32,7 @@ import java.util.concurrent.locks.ReentrantLock;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.MultiFields;

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search;
*/ */
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.util.ToStringUtils; import org.apache.lucene.util.ToStringUtils;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.Collector; import org.apache.lucene.search.Collector;
import org.apache.lucene.search.Scorer; import org.apache.lucene.search.Scorer;

View File

@ -22,8 +22,8 @@ import java.util.*;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
@ -178,7 +178,7 @@ public class MultiPhraseQuery extends Query {
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder, public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
boolean topScorer, Bits acceptDocs) throws IOException { boolean topScorer, Bits acceptDocs) throws IOException {
assert !termArrays.isEmpty(); assert !termArrays.isEmpty();
final AtomicIndexReader reader = context.reader(); final AtomicReader reader = context.reader();
final Bits liveDocs = acceptDocs; final Bits liveDocs = acceptDocs;
PhraseQuery.PostingsAndFreq[] postingsFreqs = new PhraseQuery.PostingsAndFreq[termArrays.size()]; PhraseQuery.PostingsAndFreq[] postingsFreqs = new PhraseQuery.PostingsAndFreq[termArrays.size()];

View File

@ -21,8 +21,8 @@ import java.io.IOException;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.Fields; import org.apache.lucene.index.Fields;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.Terms; import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum; import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.FixedBitSet;
@ -83,7 +83,7 @@ public class MultiTermQueryWrapperFilter<Q extends MultiTermQuery> extends Filte
*/ */
@Override @Override
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException { public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
final AtomicIndexReader reader = context.reader(); final AtomicReader reader = context.reader();
final Fields fields = reader.fields(); final Fields fields = reader.fields();
if (fields == null) { if (fields == null) {
// reader has no fields // reader has no fields

View File

@ -22,10 +22,10 @@ import java.util.ArrayList;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermState; import org.apache.lucene.index.TermState;
import org.apache.lucene.index.Terms; import org.apache.lucene.index.Terms;
@ -220,7 +220,7 @@ public class PhraseQuery extends Query {
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder, public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
boolean topScorer, Bits acceptDocs) throws IOException { boolean topScorer, Bits acceptDocs) throws IOException {
assert !terms.isEmpty(); assert !terms.isEmpty();
final AtomicIndexReader reader = context.reader(); final AtomicReader reader = context.reader();
final Bits liveDocs = acceptDocs; final Bits liveDocs = acceptDocs;
PostingsAndFreq[] postingsFreqs = new PostingsAndFreq[terms.size()]; PostingsAndFreq[] postingsFreqs = new PostingsAndFreq[terms.size()];
@ -271,7 +271,7 @@ public class PhraseQuery extends Query {
} }
// only called from assert // only called from assert
private boolean termNotInReader(AtomicIndexReader reader, String field, BytesRef bytes) throws IOException { private boolean termNotInReader(AtomicReader reader, String field, BytesRef bytes) throws IOException {
return reader.docFreq(field, bytes) == 0; return reader.docFreq(field, bytes) == 0;
} }

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
/** /**
* A {@link Collector} implementation which wraps another * A {@link Collector} implementation which wraps another

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
/** /**

View File

@ -25,7 +25,7 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.Terms; import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum; import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.util.AttributeSource; import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;

View File

@ -21,9 +21,9 @@ import java.io.IOException;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermState; import org.apache.lucene.index.TermState;
import org.apache.lucene.index.TermsEnum; import org.apache.lucene.index.TermsEnum;
@ -117,7 +117,7 @@ public class TermQuery extends Query {
return termsEnum; return termsEnum;
} }
private boolean termNotInReader(AtomicIndexReader reader, String field, BytesRef bytes) throws IOException { private boolean termNotInReader(AtomicReader reader, String field, BytesRef bytes) throws IOException {
// only called from assert // only called from assert
//System.out.println("TQ.termNotInReader reader=" + reader + " term=" + field + ":" + bytes.utf8ToString()); //System.out.println("TQ.termNotInReader reader=" + reader + " term=" + field + ":" + bytes.utf8ToString());
return reader.docFreq(field, bytes) == 0; return reader.docFreq(field, bytes) == 0;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.Counter; import org.apache.lucene.util.Counter;
import org.apache.lucene.util.ThreadInterruptedException; import org.apache.lucene.util.ThreadInterruptedException;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.FieldValueHitQueue.Entry; import org.apache.lucene.search.FieldValueHitQueue.Entry;
import org.apache.lucene.util.PriorityQueue; import org.apache.lucene.util.PriorityQueue;

View File

@ -19,7 +19,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
/** /**
* A {@link Collector} implementation that collects the top-scoring hits, * A {@link Collector} implementation that collects the top-scoring hits,

View File

@ -17,7 +17,7 @@ package org.apache.lucene.search;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
/** /**
* Just counts the total number of hits. * Just counts the total number of hits.

View File

@ -20,7 +20,7 @@ package org.apache.lucene.search;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.search.similarities.SimilarityProvider; import org.apache.lucene.search.similarities.SimilarityProvider;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -17,7 +17,7 @@ package org.apache.lucene.search.payloads;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.ComplexExplanation; import org.apache.lucene.search.ComplexExplanation;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.Scorer; import org.apache.lucene.search.Scorer;

View File

@ -27,7 +27,7 @@ import java.util.Map;
import java.util.TreeSet; import java.util.TreeSet;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanClause;

View File

@ -17,7 +17,7 @@ package org.apache.lucene.search.payloads;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Norm; import org.apache.lucene.index.Norm;
import org.apache.lucene.search.CollectionStatistics; import org.apache.lucene.search.CollectionStatistics;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;

View File

@ -20,7 +20,7 @@ package org.apache.lucene.search.similarities;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Norm; import org.apache.lucene.index.Norm;
import org.apache.lucene.search.CollectionStatistics; import org.apache.lucene.search.CollectionStatistics;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;

View File

@ -23,7 +23,7 @@ import java.io.IOException;
import org.apache.lucene.document.DocValuesField; // javadoc import org.apache.lucene.document.DocValuesField; // javadoc
import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexReader; // javadoc import org.apache.lucene.index.IndexReader; // javadoc
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Norm; import org.apache.lucene.index.Norm;
import org.apache.lucene.index.Terms; // javadoc import org.apache.lucene.index.Terms; // javadoc
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery;

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Norm; import org.apache.lucene.index.Norm;
import org.apache.lucene.search.CollectionStatistics; import org.apache.lucene.search.CollectionStatistics;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;

View File

@ -21,7 +21,7 @@ package org.apache.lucene.search.similarities;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.search.CollectionStatistics; import org.apache.lucene.search.CollectionStatistics;
import org.apache.lucene.search.Explanation; import org.apache.lucene.search.Explanation;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;

View File

@ -22,7 +22,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.Weight; import org.apache.lucene.search.Weight;

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
*/ */
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.TermContext; import org.apache.lucene.util.TermContext;

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
*/ */
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.PriorityQueue; import org.apache.lucene.util.PriorityQueue;
import org.apache.lucene.util.TermContext; import org.apache.lucene.util.TermContext;

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import java.util.Map; import java.util.Map;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.MultiTermQuery; import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;

View File

@ -28,7 +28,7 @@ import java.util.Set;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
*/ */
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -27,7 +27,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.PriorityQueue; import org.apache.lucene.util.PriorityQueue;

View File

@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -20,7 +20,7 @@ package org.apache.lucene.search.spans;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;

View File

@ -17,7 +17,7 @@ package org.apache.lucene.search.spans;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.Fields; import org.apache.lucene.index.Fields;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;

View File

@ -17,7 +17,7 @@ package org.apache.lucene.search.spans;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.*; import org.apache.lucene.search.*;

View File

@ -23,7 +23,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.FieldCache.CacheEntry; import org.apache.lucene.search.FieldCache.CacheEntry;

View File

@ -23,10 +23,10 @@ import java.io.IOException;
import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos; import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.CompositeIndexReader; import org.apache.lucene.index.CompositeReader;
import org.apache.lucene.index.CompositeIndexReader.CompositeReaderContext; import org.apache.lucene.index.CompositeReader.CompositeReaderContext;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
@ -68,11 +68,11 @@ public final class ReaderUtil {
* @param reader * @param reader
*/ */
public static void gatherSubReaders(final List<AtomicIndexReader> allSubReaders, IndexReader reader) { public static void gatherSubReaders(final List<AtomicReader> allSubReaders, IndexReader reader) {
try { try {
new Gather(reader) { new Gather(reader) {
@Override @Override
protected void add(int base, AtomicIndexReader r) { protected void add(int base, AtomicReader r) {
allSubReaders.add(r); allSubReaders.add(r);
} }
}.run(); }.run();
@ -103,13 +103,13 @@ public final class ReaderUtil {
} }
private int run(int base, IndexReader reader) throws IOException { private int run(int base, IndexReader reader) throws IOException {
if (reader instanceof AtomicIndexReader) { if (reader instanceof AtomicReader) {
// atomic reader // atomic reader
add(base, (AtomicIndexReader) reader); add(base, (AtomicReader) reader);
base += reader.maxDoc(); base += reader.maxDoc();
} else { } else {
assert reader instanceof CompositeIndexReader : "must be a composite reader"; assert reader instanceof CompositeReader : "must be a composite reader";
IndexReader[] subReaders = ((CompositeIndexReader) reader).getSequentialSubReaders(); IndexReader[] subReaders = ((CompositeReader) reader).getSequentialSubReaders();
for (int i = 0; i < subReaders.length; i++) { for (int i = 0; i < subReaders.length; i++) {
base = run(base, subReaders[i]); base = run(base, subReaders[i]);
} }
@ -118,7 +118,7 @@ public final class ReaderUtil {
return base; return base;
} }
protected abstract void add(int base, AtomicIndexReader r) throws IOException; protected abstract void add(int base, AtomicReader r) throws IOException;
} }
public static ReaderContext buildReaderContext(IndexReader reader) { public static ReaderContext buildReaderContext(IndexReader reader) {
@ -140,13 +140,13 @@ public final class ReaderUtil {
} }
private ReaderContext build(CompositeReaderContext parent, IndexReader reader, int ord, int docBase) { private ReaderContext build(CompositeReaderContext parent, IndexReader reader, int ord, int docBase) {
if (reader instanceof AtomicIndexReader) { if (reader instanceof AtomicReader) {
AtomicReaderContext atomic = new AtomicReaderContext(parent, (AtomicIndexReader) reader, ord, docBase, leafOrd, leafDocBase); AtomicReaderContext atomic = new AtomicReaderContext(parent, (AtomicReader) reader, ord, docBase, leafOrd, leafDocBase);
leaves[leafOrd++] = atomic; leaves[leafOrd++] = atomic;
leafDocBase += reader.maxDoc(); leafDocBase += reader.maxDoc();
return atomic; return atomic;
} else { } else {
CompositeIndexReader cr = (CompositeIndexReader) reader; CompositeReader cr = (CompositeReader) reader;
IndexReader[] sequentialSubReaders = cr.getSequentialSubReaders(); IndexReader[] sequentialSubReaders = cr.getSequentialSubReaders();
ReaderContext[] children = new ReaderContext[sequentialSubReaders.length]; ReaderContext[] children = new ReaderContext[sequentialSubReaders.length];
final CompositeReaderContext newParent; final CompositeReaderContext newParent;
@ -170,7 +170,7 @@ public final class ReaderUtil {
try { try {
new Gather(reader) { new Gather(reader) {
@Override @Override
protected void add(int base, AtomicIndexReader r) { protected void add(int base, AtomicReader r) {
numLeaves[0]++; numLeaves[0]++;
} }
}.run(); }.run();

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import org.apache.lucene.index.Fields; import org.apache.lucene.index.Fields;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;

View File

@ -455,7 +455,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
conf.setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() { conf.setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
@Override @Override
public void warm(AtomicIndexReader reader) throws IOException { public void warm(AtomicReader reader) throws IOException {
if (VERBOSE) { if (VERBOSE) {
System.out.println("TEST: now warm merged reader=" + reader); System.out.println("TEST: now warm merged reader=" + reader);
} }

View File

@ -22,7 +22,7 @@ import java.util.concurrent.ExecutorService;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;

View File

@ -26,7 +26,7 @@ import java.util.Random;
import junit.framework.Assert; import junit.framework.Assert;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;

View File

@ -24,10 +24,10 @@ import junit.framework.Assert;
import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.MultiReader; import org.apache.lucene.index.MultiReader;
@ -239,7 +239,7 @@ public class QueryUtils {
// FUTURE: ensure scorer.doc()==-1 // FUTURE: ensure scorer.doc()==-1
final float maxDiff = 1e-5f; final float maxDiff = 1e-5f;
final AtomicIndexReader lastReader[] = {null}; final AtomicReader lastReader[] = {null};
s.search(q, new Collector() { s.search(q, new Collector() {
private Scorer sc; private Scorer sc;
@ -301,7 +301,7 @@ public class QueryUtils {
// confirm that skipping beyond the last doc, on the // confirm that skipping beyond the last doc, on the
// previous reader, hits NO_MORE_DOCS // previous reader, hits NO_MORE_DOCS
if (lastReader[0] != null) { if (lastReader[0] != null) {
final AtomicIndexReader previousReader = lastReader[0]; final AtomicReader previousReader = lastReader[0];
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader); IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
Weight w = indexSearcher.createNormalizedWeight(q); Weight w = indexSearcher.createNormalizedWeight(q);
AtomicReaderContext ctx = (AtomicReaderContext)indexSearcher.getTopReaderContext(); AtomicReaderContext ctx = (AtomicReaderContext)indexSearcher.getTopReaderContext();
@ -327,7 +327,7 @@ public class QueryUtils {
if (lastReader[0] != null) { if (lastReader[0] != null) {
// confirm that skipping beyond the last doc, on the // confirm that skipping beyond the last doc, on the
// previous reader, hits NO_MORE_DOCS // previous reader, hits NO_MORE_DOCS
final AtomicIndexReader previousReader = lastReader[0]; final AtomicReader previousReader = lastReader[0];
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader, false); IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader, false);
Weight w = indexSearcher.createNormalizedWeight(q); Weight w = indexSearcher.createNormalizedWeight(q);
AtomicReaderContext ctx = previousReader.getTopReaderContext(); AtomicReaderContext ctx = previousReader.getTopReaderContext();
@ -345,7 +345,7 @@ public class QueryUtils {
//System.out.println("checkFirstSkipTo: "+q); //System.out.println("checkFirstSkipTo: "+q);
final float maxDiff = 1e-3f; final float maxDiff = 1e-3f;
final int lastDoc[] = {-1}; final int lastDoc[] = {-1};
final AtomicIndexReader lastReader[] = {null}; final AtomicReader lastReader[] = {null};
final AtomicReaderContext[] context = ReaderUtil.leaves(s.getTopReaderContext()); final AtomicReaderContext[] context = ReaderUtil.leaves(s.getTopReaderContext());
s.search(q,new Collector() { s.search(q,new Collector() {
private Scorer scorer; private Scorer scorer;
@ -386,7 +386,7 @@ public class QueryUtils {
// confirm that skipping beyond the last doc, on the // confirm that skipping beyond the last doc, on the
// previous reader, hits NO_MORE_DOCS // previous reader, hits NO_MORE_DOCS
if (lastReader[0] != null) { if (lastReader[0] != null) {
final AtomicIndexReader previousReader = lastReader[0]; final AtomicReader previousReader = lastReader[0];
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader); IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
Weight w = indexSearcher.createNormalizedWeight(q); Weight w = indexSearcher.createNormalizedWeight(q);
Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), true, false, previousReader.getLiveDocs()); Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), true, false, previousReader.getLiveDocs());
@ -410,7 +410,7 @@ public class QueryUtils {
if (lastReader[0] != null) { if (lastReader[0] != null) {
// confirm that skipping beyond the last doc, on the // confirm that skipping beyond the last doc, on the
// previous reader, hits NO_MORE_DOCS // previous reader, hits NO_MORE_DOCS
final AtomicIndexReader previousReader = lastReader[0]; final AtomicReader previousReader = lastReader[0];
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader); IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
Weight w = indexSearcher.createNormalizedWeight(q); Weight w = indexSearcher.createNormalizedWeight(q);
Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), true, false, previousReader.getLiveDocs()); Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), true, false, previousReader.getLiveDocs());

View File

@ -22,7 +22,7 @@ import java.util.Random;
import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat; import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
@ -53,7 +53,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
DirectoryReader open = DirectoryReader.open(dir); DirectoryReader open = DirectoryReader.open(dir);
new ReaderUtil.Gather(open) { new ReaderUtil.Gather(open) {
@Override @Override
protected void add(int base, AtomicIndexReader r) throws IOException { protected void add(int base, AtomicReader r) throws IOException {
Terms terms = r.terms("body"); Terms terms = r.terms("body");
TermsEnum iterator = terms.iterator(null); TermsEnum iterator = terms.iterator(null);
IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>(); IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
@ -82,7 +82,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
DirectoryReader open = DirectoryReader.open(dir); DirectoryReader open = DirectoryReader.open(dir);
IndexReader[] sequentialSubReaders = open.getSequentialSubReaders(); IndexReader[] sequentialSubReaders = open.getSequentialSubReaders();
for (IndexReader indexReader : sequentialSubReaders) { for (IndexReader indexReader : sequentialSubReaders) {
Terms terms = ((AtomicIndexReader) indexReader).terms("body"); Terms terms = ((AtomicReader) indexReader).terms("body");
TermsEnum iterator = terms.iterator(null); TermsEnum iterator = terms.iterator(null);
IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>(); IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
MatchNoBits bits = new Bits.MatchNoBits(open.maxDoc()); MatchNoBits bits = new Bits.MatchNoBits(open.maxDoc());
@ -130,7 +130,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
IndexReader[] sequentialSubReaders2 = secondReader.getSequentialSubReaders(); IndexReader[] sequentialSubReaders2 = secondReader.getSequentialSubReaders();
for (IndexReader indexReader : sequentialSubReaders) { for (IndexReader indexReader : sequentialSubReaders) {
Terms terms = ((AtomicIndexReader) indexReader).terms("body"); Terms terms = ((AtomicReader) indexReader).terms("body");
TermsEnum iterator = terms.iterator(null); TermsEnum iterator = terms.iterator(null);
IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>(); IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
MatchNoBits bits = new Bits.MatchNoBits(firstReader.maxDoc()); MatchNoBits bits = new Bits.MatchNoBits(firstReader.maxDoc());
@ -159,7 +159,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
if (random.nextInt(10) == 0) { if (random.nextInt(10) == 0) {
return null; return null;
} }
AtomicIndexReader indexReader = (AtomicIndexReader) readers[random.nextInt(readers.length)]; AtomicReader indexReader = (AtomicReader) readers[random.nextInt(readers.length)];
return indexReader.termDocsEnum(bits, field, term, random.nextBoolean()); return indexReader.termDocsEnum(bits, field, term, random.nextBoolean());
} }

View File

@ -26,7 +26,7 @@ import org.apache.lucene.codecs.nestedpulsing.NestedPulsingPostingsFormat;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field; import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField; import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicIndexReader; import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.CheckIndex; import org.apache.lucene.index.CheckIndex;
import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.DocsAndPositionsEnum;
@ -56,7 +56,7 @@ public class TestPulsingReuse extends LuceneTestCase {
DirectoryReader ir = iw.getReader(); DirectoryReader ir = iw.getReader();
iw.close(); iw.close();
AtomicIndexReader segment = getOnlySegmentReader(ir); AtomicReader segment = getOnlySegmentReader(ir);
DocsEnum reuse = null; DocsEnum reuse = null;
Map<DocsEnum,Boolean> allEnums = new IdentityHashMap<DocsEnum,Boolean>(); Map<DocsEnum,Boolean> allEnums = new IdentityHashMap<DocsEnum,Boolean>();
TermsEnum te = segment.terms("foo").iterator(null); TermsEnum te = segment.terms("foo").iterator(null);
@ -98,7 +98,7 @@ public class TestPulsingReuse extends LuceneTestCase {
DirectoryReader ir = iw.getReader(); DirectoryReader ir = iw.getReader();
iw.close(); iw.close();
AtomicIndexReader segment = getOnlySegmentReader(ir); AtomicReader segment = getOnlySegmentReader(ir);
DocsEnum reuse = null; DocsEnum reuse = null;
Map<DocsEnum,Boolean> allEnums = new IdentityHashMap<DocsEnum,Boolean>(); Map<DocsEnum,Boolean> allEnums = new IdentityHashMap<DocsEnum,Boolean>();
TermsEnum te = segment.terms("foo").iterator(null); TermsEnum te = segment.terms("foo").iterator(null);

View File

@ -1288,7 +1288,7 @@ public class TestAddIndexes extends LuceneTestCase {
w.forceMerge(1); w.forceMerge(1);
DirectoryReader r3 = w.getReader(); DirectoryReader r3 = w.getReader();
w.close(); w.close();
AtomicIndexReader sr = getOnlySegmentReader(r3); AtomicReader sr = getOnlySegmentReader(r3);
assertEquals(2, sr.numDocs()); assertEquals(2, sr.numDocs());
DocValues docValues = sr.docValues("dv"); DocValues docValues = sr.docValues("dv");
assertNotNull(docValues); assertNotNull(docValues);

View File

@ -79,7 +79,7 @@ public class TestCustomNorms extends LuceneTestCase {
} }
writer.commit(); writer.commit();
writer.close(); writer.close();
AtomicIndexReader open = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir)); AtomicReader open = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir));
DocValues normValues = open.normValues(floatTestField); DocValues normValues = open.normValues(floatTestField);
assertNotNull(normValues); assertNotNull(normValues);
Source source = normValues.getSource(); Source source = normValues.getSource();

View File

@ -160,7 +160,7 @@ public class TestDocTermOrds extends LuceneTestCase {
if (VERBOSE) { if (VERBOSE) {
System.out.println("\nTEST: sub=" + subR); System.out.println("\nTEST: sub=" + subR);
} }
verify((AtomicIndexReader) subR, idToOrds, termsArray, null); verify((AtomicReader) subR, idToOrds, termsArray, null);
} }
// Also test top-level reader: its enum does not support // Also test top-level reader: its enum does not support
@ -168,7 +168,7 @@ public class TestDocTermOrds extends LuceneTestCase {
if (VERBOSE) { if (VERBOSE) {
System.out.println("TEST: top reader"); System.out.println("TEST: top reader");
} }
AtomicIndexReader slowR = SlowCompositeReaderWrapper.wrap(r); AtomicReader slowR = SlowCompositeReaderWrapper.wrap(r);
verify(slowR, idToOrds, termsArray, null); verify(slowR, idToOrds, termsArray, null);
FieldCache.DEFAULT.purge(slowR); FieldCache.DEFAULT.purge(slowR);
@ -253,7 +253,7 @@ public class TestDocTermOrds extends LuceneTestCase {
System.out.println("TEST: reader=" + r); System.out.println("TEST: reader=" + r);
} }
AtomicIndexReader slowR = SlowCompositeReaderWrapper.wrap(r); AtomicReader slowR = SlowCompositeReaderWrapper.wrap(r);
for(String prefix : prefixesArray) { for(String prefix : prefixesArray) {
final BytesRef prefixRef = prefix == null ? null : new BytesRef(prefix); final BytesRef prefixRef = prefix == null ? null : new BytesRef(prefix);
@ -279,7 +279,7 @@ public class TestDocTermOrds extends LuceneTestCase {
if (VERBOSE) { if (VERBOSE) {
System.out.println("\nTEST: sub=" + subR); System.out.println("\nTEST: sub=" + subR);
} }
verify((AtomicIndexReader) subR, idToOrdsPrefix, termsArray, prefixRef); verify((AtomicReader) subR, idToOrdsPrefix, termsArray, prefixRef);
} }
// Also test top-level reader: its enum does not support // Also test top-level reader: its enum does not support
@ -296,7 +296,7 @@ public class TestDocTermOrds extends LuceneTestCase {
dir.close(); dir.close();
} }
private void verify(AtomicIndexReader r, int[][] idToOrds, BytesRef[] termsArray, BytesRef prefixRef) throws Exception { private void verify(AtomicReader r, int[][] idToOrds, BytesRef[] termsArray, BytesRef prefixRef) throws Exception {
final DocTermOrds dto = new DocTermOrds(r, final DocTermOrds dto = new DocTermOrds(r,
"field", "field",

View File

@ -696,7 +696,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
w.forceMerge(1); w.forceMerge(1);
DirectoryReader r = w.getReader(); DirectoryReader r = w.getReader();
w.close(); w.close();
assertEquals(17, ((AtomicIndexReader) r.getSequentialSubReaders()[0]).docValues("field").load().getInt(0)); assertEquals(17, ((AtomicReader) r.getSequentialSubReaders()[0]).docValues("field").load().getInt(0));
r.close(); r.close();
d.close(); d.close();
} }
@ -795,7 +795,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
int ord = asSortedSource.getByValue(expected, actual); int ord = asSortedSource.getByValue(expected, actual);
assertEquals(i, ord); assertEquals(i, ord);
} }
AtomicIndexReader slowR = SlowCompositeReaderWrapper.wrap(reader); AtomicReader slowR = SlowCompositeReaderWrapper.wrap(reader);
Set<Entry<String, String>> entrySet = docToString.entrySet(); Set<Entry<String, String>> entrySet = docToString.entrySet();
for (Entry<String, String> entry : entrySet) { for (Entry<String, String> entry : entrySet) {
@ -810,7 +810,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
} }
} }
public int docId(AtomicIndexReader reader, Term term) throws IOException { public int docId(AtomicReader reader, Term term) throws IOException {
int docFreq = reader.docFreq(term); int docFreq = reader.docFreq(term);
assertEquals(1, docFreq); assertEquals(1, docFreq);
DocsEnum termDocsEnum = reader.termDocsEnum(null, term.field, term.bytes, false); DocsEnum termDocsEnum = reader.termDocsEnum(null, term.field, term.bytes, false);

View File

@ -25,7 +25,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldType; import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StringField; import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField; import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext; import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader.ReaderContext; import org.apache.lucene.index.IndexReader.ReaderContext;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
@ -94,7 +94,7 @@ public class TestDocsAndPositions extends LuceneTestCase {
directory.close(); directory.close();
} }
public DocsAndPositionsEnum getDocsAndPositions(AtomicIndexReader reader, public DocsAndPositionsEnum getDocsAndPositions(AtomicReader reader,
BytesRef bytes, Bits liveDocs) throws IOException { BytesRef bytes, Bits liveDocs) throws IOException {
return reader.termPositionsEnum(null, fieldName, bytes, false); return reader.termPositionsEnum(null, fieldName, bytes, false);
} }
@ -332,7 +332,7 @@ public class TestDocsAndPositions extends LuceneTestCase {
doc.add(newField("foo", "bar", StringField.TYPE_UNSTORED)); doc.add(newField("foo", "bar", StringField.TYPE_UNSTORED));
writer.addDocument(doc); writer.addDocument(doc);
DirectoryReader reader = writer.getReader(); DirectoryReader reader = writer.getReader();
AtomicIndexReader r = getOnlySegmentReader(reader); AtomicReader r = getOnlySegmentReader(reader);
DocsEnum disi = _TestUtil.docs(random, r, "foo", new BytesRef("bar"), null, null, false); DocsEnum disi = _TestUtil.docs(random, r, "foo", new BytesRef("bar"), null, null, false);
int docid = disi.docID(); int docid = disi.docID();
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS); assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);
@ -357,7 +357,7 @@ public class TestDocsAndPositions extends LuceneTestCase {
doc.add(newField("foo", "bar", TextField.TYPE_UNSTORED)); doc.add(newField("foo", "bar", TextField.TYPE_UNSTORED));
writer.addDocument(doc); writer.addDocument(doc);
DirectoryReader reader = writer.getReader(); DirectoryReader reader = writer.getReader();
AtomicIndexReader r = getOnlySegmentReader(reader); AtomicReader r = getOnlySegmentReader(reader);
DocsAndPositionsEnum disi = r.termPositionsEnum(null, "foo", new BytesRef("bar"), false); DocsAndPositionsEnum disi = r.termPositionsEnum(null, "foo", new BytesRef("bar"), false);
int docid = disi.docID(); int docid = disi.docID();
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS); assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);

View File

@ -278,7 +278,7 @@ public class TestFieldsReader extends LuceneTestCase {
assertEquals(numDocs, r.numDocs()); assertEquals(numDocs, r.numDocs());
for(IndexReader sub : r.getSequentialSubReaders()) { for(IndexReader sub : r.getSequentialSubReaders()) {
final int[] ids = FieldCache.DEFAULT.getInts((AtomicIndexReader) sub, "id", false); final int[] ids = FieldCache.DEFAULT.getInts((AtomicReader) sub, "id", false);
for(int docID=0;docID<sub.numDocs();docID++) { for(int docID=0;docID<sub.numDocs();docID++) {
final Document doc = sub.document(docID); final Document doc = sub.document(docID);
final Field f = (Field) doc.getField("nf"); final Field f = (Field) doc.getField("nf");

View File

@ -687,7 +687,7 @@ public class TestIndexReader extends LuceneTestCase {
// Open reader1 // Open reader1
DirectoryReader r = DirectoryReader.open(dir); DirectoryReader r = DirectoryReader.open(dir);
AtomicIndexReader r1 = getOnlySegmentReader(r); AtomicReader r1 = getOnlySegmentReader(r);
final int[] ints = FieldCache.DEFAULT.getInts(r1, "number", false); final int[] ints = FieldCache.DEFAULT.getInts(r1, "number", false);
assertEquals(1, ints.length); assertEquals(1, ints.length);
assertEquals(17, ints[0]); assertEquals(17, ints[0]);
@ -700,7 +700,7 @@ public class TestIndexReader extends LuceneTestCase {
DirectoryReader r2 = DirectoryReader.openIfChanged(r); DirectoryReader r2 = DirectoryReader.openIfChanged(r);
assertNotNull(r2); assertNotNull(r2);
r.close(); r.close();
AtomicIndexReader sub0 = (AtomicIndexReader) r2.getSequentialSubReaders()[0]; AtomicReader sub0 = (AtomicReader) r2.getSequentialSubReaders()[0];
final int[] ints2 = FieldCache.DEFAULT.getInts(sub0, "number", false); final int[] ints2 = FieldCache.DEFAULT.getInts(sub0, "number", false);
r2.close(); r2.close();
assertTrue(ints == ints2); assertTrue(ints == ints2);
@ -721,7 +721,7 @@ public class TestIndexReader extends LuceneTestCase {
writer.commit(); writer.commit();
DirectoryReader r = DirectoryReader.open(dir); DirectoryReader r = DirectoryReader.open(dir);
AtomicIndexReader r1 = getOnlySegmentReader(r); AtomicReader r1 = getOnlySegmentReader(r);
assertEquals(36, r1.getUniqueTermCount()); assertEquals(36, r1.getUniqueTermCount());
writer.addDocument(doc); writer.addDocument(doc);
writer.commit(); writer.commit();
@ -731,7 +731,7 @@ public class TestIndexReader extends LuceneTestCase {
IndexReader[] subs = r2.getSequentialSubReaders(); IndexReader[] subs = r2.getSequentialSubReaders();
for(int i=0;i<subs.length;i++) { for(int i=0;i<subs.length;i++) {
assertEquals(36, ((AtomicIndexReader) subs[i]).getUniqueTermCount()); assertEquals(36, ((AtomicReader) subs[i]).getUniqueTermCount());
} }
r2.close(); r2.close();
writer.close(); writer.close();

View File

@ -540,13 +540,13 @@ public class TestIndexReaderReopen extends LuceneTestCase {
static void assertReaderClosed(IndexReader reader, boolean checkSubReaders, boolean checkNormsClosed) { static void assertReaderClosed(IndexReader reader, boolean checkSubReaders, boolean checkNormsClosed) {
assertEquals(0, reader.getRefCount()); assertEquals(0, reader.getRefCount());
if (checkNormsClosed && reader instanceof AtomicIndexReader) { if (checkNormsClosed && reader instanceof AtomicReader) {
// TODO: should we really assert something here? we check for open files and this is obselete... // TODO: should we really assert something here? we check for open files and this is obselete...
// assertTrue(((SegmentReader) reader).normsClosed()); // assertTrue(((SegmentReader) reader).normsClosed());
} }
if (checkSubReaders && reader instanceof CompositeIndexReader) { if (checkSubReaders && reader instanceof CompositeReader) {
IndexReader[] subReaders = ((CompositeIndexReader) reader).getSequentialSubReaders(); IndexReader[] subReaders = ((CompositeReader) reader).getSequentialSubReaders();
for (int i = 0; i < subReaders.length; i++) { for (int i = 0; i < subReaders.length; i++) {
assertReaderClosed(subReaders[i], checkSubReaders, checkNormsClosed); assertReaderClosed(subReaders[i], checkSubReaders, checkNormsClosed);
} }

View File

@ -776,7 +776,7 @@ public class TestIndexWriter extends LuceneTestCase {
writer.addDocument(doc); writer.addDocument(doc);
writer.close(); writer.close();
DirectoryReader reader = IndexReader.open(dir); DirectoryReader reader = IndexReader.open(dir);
AtomicIndexReader subreader = getOnlySegmentReader(reader); AtomicReader subreader = getOnlySegmentReader(reader);
TermsEnum te = subreader.fields().terms("").iterator(null); TermsEnum te = subreader.fields().terms("").iterator(null);
assertEquals(new BytesRef("a"), te.next()); assertEquals(new BytesRef("a"), te.next());
assertEquals(new BytesRef("b"), te.next()); assertEquals(new BytesRef("b"), te.next());
@ -797,7 +797,7 @@ public class TestIndexWriter extends LuceneTestCase {
writer.addDocument(doc); writer.addDocument(doc);
writer.close(); writer.close();
DirectoryReader reader = IndexReader.open(dir); DirectoryReader reader = IndexReader.open(dir);
AtomicIndexReader subreader = getOnlySegmentReader(reader); AtomicReader subreader = getOnlySegmentReader(reader);
TermsEnum te = subreader.fields().terms("").iterator(null); TermsEnum te = subreader.fields().terms("").iterator(null);
assertEquals(new BytesRef(""), te.next()); assertEquals(new BytesRef(""), te.next());
assertEquals(new BytesRef("a"), te.next()); assertEquals(new BytesRef("a"), te.next());
@ -1301,7 +1301,7 @@ public class TestIndexWriter extends LuceneTestCase {
d.add(f); d.add(f);
w.addDocument(d); w.addDocument(d);
AtomicIndexReader r = getOnlySegmentReader(w.getReader()); AtomicReader r = getOnlySegmentReader(w.getReader());
TermsEnum t = r.fields().terms("field").iterator(null); TermsEnum t = r.fields().terms("field").iterator(null);
int count = 0; int count = 0;
while(t.next() != null) { while(t.next() != null) {

View File

@ -602,7 +602,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
private static class MyWarmer extends IndexWriter.IndexReaderWarmer { private static class MyWarmer extends IndexWriter.IndexReaderWarmer {
int warmCount; int warmCount;
@Override @Override
public void warm(AtomicIndexReader reader) throws IOException { public void warm(AtomicReader reader) throws IOException {
warmCount++; warmCount++;
} }
} }
@ -946,7 +946,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
setReaderPooling(true). setReaderPooling(true).
setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() { setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
@Override @Override
public void warm(AtomicIndexReader r) throws IOException { public void warm(AtomicReader r) throws IOException {
IndexSearcher s = newSearcher(r); IndexSearcher s = newSearcher(r);
TopDocs hits = s.search(new TermQuery(new Term("foo", "bar")), 10); TopDocs hits = s.search(new TermQuery(new Term("foo", "bar")), 10);
assertEquals(20, hits.totalHits); assertEquals(20, hits.totalHits);

Some files were not shown because too many files have changed in this diff Show More