mirror of https://github.com/apache/lucene.git
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:
parent
10ba9abeb2
commit
2d4c738067
|
@ -31,7 +31,7 @@ import org.apache.lucene.analysis.CachingTokenFilter;
|
|||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
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.search.*;
|
||||
import org.apache.lucene.search.spans.FieldMaskingSpanQuery;
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.lucene.index.CorruptIndexException;
|
|||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
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.IndexSearcher;
|
||||
import org.apache.lucene.search.PhraseQuery;
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
|
|||
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
|
||||
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;
|
||||
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.DocValues;
|
||||
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.Fields;
|
||||
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.OrdTermState;
|
||||
import org.apache.lucene.index.StoredFieldVisitor;
|
||||
|
@ -750,7 +750,7 @@ public class MemoryIndex {
|
|||
* Search support for Lucene framework integration; implements all methods
|
||||
* 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()
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat;
|
|||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
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.DocsEnum;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
@ -186,7 +186,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
|
|||
Analyzer analyzer = new MockAnalyzer(random);
|
||||
MemoryIndex memory = new MemoryIndex();
|
||||
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);
|
||||
int docid = disi.docID();
|
||||
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);
|
||||
|
@ -206,7 +206,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
|
|||
Analyzer analyzer = new MockAnalyzer(random);
|
||||
MemoryIndex memory = new MemoryIndex();
|
||||
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);
|
||||
int docid = disi.docID();
|
||||
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);
|
||||
|
|
|
@ -182,15 +182,15 @@ public class MultiPassIndexSplitter {
|
|||
super(initSubReaders(reader), false /* dont close */);
|
||||
}
|
||||
|
||||
private static AtomicIndexReader[] initSubReaders(IndexReader reader) throws IOException {
|
||||
final ArrayList<AtomicIndexReader> subs = new ArrayList<AtomicIndexReader>();
|
||||
private static AtomicReader[] initSubReaders(IndexReader reader) throws IOException {
|
||||
final ArrayList<AtomicReader> subs = new ArrayList<AtomicReader>();
|
||||
new ReaderUtil.Gather(reader) {
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) {
|
||||
protected void add(int base, AtomicReader r) {
|
||||
subs.add(new FakeDeleteAtomicIndexReader(r));
|
||||
}
|
||||
}.run();
|
||||
return subs.toArray(new AtomicIndexReader[subs.size()]);
|
||||
return subs.toArray(new AtomicReader[subs.size()]);
|
||||
}
|
||||
|
||||
public void deleteDocument(int docID) {
|
||||
|
@ -226,7 +226,7 @@ public class MultiPassIndexSplitter {
|
|||
private static final class FakeDeleteAtomicIndexReader extends FilterIndexReader {
|
||||
FixedBitSet liveDocs;
|
||||
|
||||
public FakeDeleteAtomicIndexReader(AtomicIndexReader reader) {
|
||||
public FakeDeleteAtomicIndexReader(AtomicReader reader) {
|
||||
super(reader);
|
||||
undeleteAll(); // initialize main bitset
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
|||
import java.io.IOException;
|
||||
|
||||
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.DocIdSetIterator;
|
||||
import org.apache.lucene.search.Filter;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.misc;
|
|||
* 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.MultiFields;
|
||||
import org.apache.lucene.index.Fields;
|
||||
|
@ -188,7 +188,7 @@ public class HighFreqTerms {
|
|||
new ReaderUtil.Gather(reader) {
|
||||
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) throws IOException {
|
||||
protected void add(int base, AtomicReader r) throws IOException {
|
||||
Bits liveDocs = r.getLiveDocs();
|
||||
if (liveDocs == null) {
|
||||
// TODO: we could do this up front, during the scan
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.sandbox.queries;
|
|||
*/
|
||||
|
||||
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.Filter;
|
||||
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
|
||||
Terms terms = reader.fields().terms(fieldName);
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class DuplicateFilter extends Filter {
|
|||
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());
|
||||
bits.set(0, reader.maxDoc()); //assume all are valid
|
||||
Terms terms = reader.fields().terms(fieldName);
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.sandbox.queries;
|
|||
import java.io.IOException;
|
||||
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.DocTerms;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.spatial.geohash;
|
|||
|
||||
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.DocTerms;
|
||||
import org.apache.lucene.search.Filter;
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
|
||||
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.DocIdSet;
|
||||
import org.apache.lucene.search.DocIdSetIterator;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.spatial.tier;
|
|||
|
||||
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.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.spatial.tier;
|
|||
|
||||
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.FieldCache;
|
||||
import org.apache.lucene.search.Filter;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.document.FieldType;
|
|||
import org.apache.lucene.document.NumericField;
|
||||
import org.apache.lucene.document.TextField;
|
||||
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.IndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
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.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
|
||||
* {@link FieldInfo}. This method is used for merging and uses
|
||||
* {@link AtomicIndexReader#docValues(String)} by default.
|
||||
* {@link AtomicReader#docValues(String)} by default.
|
||||
* <p>
|
||||
* To enable {@link DocValues} merging for different {@link DocValues} than
|
||||
* the default override this method accordingly.
|
||||
* <p>
|
||||
*/
|
||||
protected DocValues getDocValuesForMerge(AtomicIndexReader reader, FieldInfo info) throws IOException {
|
||||
protected DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info) throws IOException {
|
||||
return reader.docValues(info.name);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.index.DocValues.Type;
|
|||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
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.SegmentInfo;
|
||||
import org.apache.lucene.index.SegmentReadState;
|
||||
|
@ -88,7 +88,7 @@ public class Lucene40NormsFormat extends NormsFormat {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DocValues getDocValuesForMerge(AtomicIndexReader reader, FieldInfo info)
|
||||
protected DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info)
|
||||
throws IOException {
|
||||
return reader.normValues(info.name);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.lucene.index.DocValues;
|
|||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
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.SegmentInfo;
|
||||
import org.apache.lucene.store.Directory;
|
||||
|
@ -87,7 +87,7 @@ public class SimpleTextNormsConsumer extends PerDocConsumer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected DocValues getDocValuesForMerge(AtomicIndexReader reader, FieldInfo info)
|
||||
protected DocValues getDocValuesForMerge(AtomicReader reader, FieldInfo info)
|
||||
throws IOException {
|
||||
return reader.normValues(info.name);
|
||||
}
|
||||
|
|
|
@ -17,17 +17,9 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.Closeable;
|
||||
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.document.Document;
|
||||
import org.apache.lucene.document.DocumentStoredFieldVisitor;
|
||||
import org.apache.lucene.index.CompositeReader.CompositeReaderContext;
|
||||
import org.apache.lucene.search.SearcherManager; // javadocs
|
||||
import org.apache.lucene.store.*;
|
||||
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
|
||||
(non-Lucene) objects instead.
|
||||
*/
|
||||
public abstract class AtomicIndexReader extends IndexReader {
|
||||
public abstract class AtomicReader extends IndexReader {
|
||||
|
||||
private final AtomicReaderContext readerContext = new AtomicReaderContext(this);
|
||||
|
||||
protected AtomicIndexReader() {
|
||||
protected AtomicReader() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -287,7 +279,7 @@ public abstract class AtomicIndexReader extends IndexReader {
|
|||
public abstract Bits getLiveDocs();
|
||||
|
||||
/**
|
||||
* {@link ReaderContext} for {@link AtomicIndexReader} instances
|
||||
* {@link ReaderContext} for {@link AtomicReader} instances
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public static final class AtomicReaderContext extends ReaderContext {
|
||||
|
@ -296,12 +288,12 @@ public abstract class AtomicIndexReader extends IndexReader {
|
|||
/** The readers absolute doc base */
|
||||
public final int docBase;
|
||||
|
||||
private final AtomicIndexReader reader;
|
||||
private final AtomicReader reader;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
super(parent, ord, docBase);
|
||||
this.ord = leafOrd;
|
||||
|
@ -309,7 +301,7 @@ public abstract class AtomicIndexReader extends IndexReader {
|
|||
this.reader = reader;
|
||||
}
|
||||
|
||||
public AtomicReaderContext(AtomicIndexReader atomicReader) {
|
||||
public AtomicReaderContext(AtomicReader atomicReader) {
|
||||
this(null, atomicReader, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -324,7 +316,7 @@ public abstract class AtomicIndexReader extends IndexReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AtomicIndexReader reader() {
|
||||
public AtomicReader reader() {
|
||||
return reader;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.util.Bits;
|
|||
import org.apache.lucene.util.BytesRef;
|
||||
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 int[] starts; // 1st docno for each segment
|
||||
private final int maxDoc;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collections;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
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.DocIdSetIterator;
|
||||
import org.apache.lucene.search.Query;
|
||||
|
|
|
@ -17,24 +17,10 @@ package org.apache.lucene.index;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.Closeable;
|
||||
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.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.search.SearcherManager; // javadocs
|
||||
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.SetOnce;
|
||||
|
||||
/** IndexReader is an abstract class, providing an interface for accessing an
|
||||
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
|
||||
(non-Lucene) objects instead.
|
||||
*/
|
||||
public abstract class CompositeIndexReader extends IndexReader {
|
||||
public abstract class CompositeReader extends IndexReader {
|
||||
|
||||
private CompositeReaderContext readerContext = null; // lazy init
|
||||
|
||||
protected CompositeIndexReader() {
|
||||
protected CompositeReader() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -113,19 +99,19 @@ public abstract class CompositeIndexReader extends IndexReader {
|
|||
public abstract IndexReader[] getSequentialSubReaders();
|
||||
|
||||
/**
|
||||
* {@link ReaderContext} for {@link CompositeIndexReader} instance.
|
||||
* {@link ReaderContext} for {@link CompositeReader} instance.
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public static final class CompositeReaderContext extends ReaderContext {
|
||||
private final ReaderContext[] children;
|
||||
private final AtomicReaderContext[] leaves;
|
||||
private final CompositeIndexReader reader;
|
||||
private final CompositeReader reader;
|
||||
|
||||
/**
|
||||
* Creates a {@link CompositeReaderContext} for intermediate readers that aren't
|
||||
* 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) {
|
||||
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>
|
||||
*/
|
||||
public CompositeReaderContext(CompositeIndexReader reader, ReaderContext[] children, AtomicReaderContext[] leaves) {
|
||||
public CompositeReaderContext(CompositeReader reader, ReaderContext[] children, AtomicReaderContext[] 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,
|
||||
AtomicReaderContext[] leaves) {
|
||||
super(parent, ordInParent, docbaseInParent);
|
||||
|
@ -158,7 +144,7 @@ public abstract class CompositeIndexReader extends IndexReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompositeIndexReader reader() {
|
||||
public CompositeReader reader() {
|
||||
return reader;
|
||||
}
|
||||
}
|
|
@ -147,19 +147,19 @@ public class DocTermOrds {
|
|||
}
|
||||
|
||||
/** 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);
|
||||
}
|
||||
|
||||
/** 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);
|
||||
}
|
||||
|
||||
/** Inverts only terms starting w/ prefix, and only terms
|
||||
* whose docFreq (not taking deletions into account) is
|
||||
* <= 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);
|
||||
uninvert(reader, termPrefix);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ public class DocTermOrds {
|
|||
* whose docFreq (not taking deletions into account) is
|
||||
* <= maxTermDocFreq, with a custom indexing interval
|
||||
* (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);
|
||||
uninvert(reader, termPrefix);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public class DocTermOrds {
|
|||
*
|
||||
* <p><b>NOTE</b>: you must pass the same reader that was
|
||||
* used when creating this class */
|
||||
public TermsEnum getOrdTermsEnum(AtomicIndexReader reader) throws IOException {
|
||||
public TermsEnum getOrdTermsEnum(AtomicReader reader) throws IOException {
|
||||
if (termInstances == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class DocTermOrds {
|
|||
}
|
||||
|
||||
// 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);
|
||||
final long startTime = System.currentTimeMillis();
|
||||
prefix = termPrefix == null ? null : BytesRef.deepCopyOf(termPrefix);
|
||||
|
@ -642,12 +642,12 @@ public class DocTermOrds {
|
|||
* ord; in this case we "wrap" our own terms index
|
||||
* around it. */
|
||||
private final class OrdWrappedTermsEnum extends TermsEnum {
|
||||
private final AtomicIndexReader reader;
|
||||
private final AtomicReader reader;
|
||||
private final TermsEnum termsEnum;
|
||||
private BytesRef term;
|
||||
private long ord = -indexInterval-1; // force "real" seek
|
||||
|
||||
public OrdWrappedTermsEnum(AtomicIndexReader reader) throws IOException {
|
||||
public OrdWrappedTermsEnum(AtomicReader reader) throws IOException {
|
||||
this.reader = reader;
|
||||
assert indexedTermsArray != null;
|
||||
termsEnum = reader.fields().terms(field).iterator(null);
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Comparator;
|
|||
* further override some of these methods and may also provide additional
|
||||
* methods and fields.
|
||||
*/
|
||||
public class FilterIndexReader extends AtomicIndexReader {
|
||||
public class FilterIndexReader extends AtomicReader {
|
||||
|
||||
/** Base class for filtering {@link Fields}
|
||||
* 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>Note that base reader is closed if this FilterIndexReader is closed.</p>
|
||||
* @param in specified base reader.
|
||||
*/
|
||||
public FilterIndexReader(AtomicIndexReader in) {
|
||||
public FilterIndexReader(AtomicReader in) {
|
||||
super();
|
||||
this.in = in;
|
||||
}
|
||||
|
|
|
@ -21,13 +21,11 @@ import java.io.Closeable;
|
|||
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.CompositeIndexReader.CompositeReaderContext;
|
||||
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.CompositeReader.CompositeReaderContext;
|
||||
import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.DocumentStoredFieldVisitor;
|
||||
import org.apache.lucene.search.SearcherManager; // javadocs
|
||||
|
|
|
@ -3954,7 +3954,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
|
|||
* <p><b>NOTE</b>: warm is called before any deletes have
|
||||
* been carried over to the merged segment. */
|
||||
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) {
|
||||
|
|
|
@ -31,10 +31,10 @@ import org.apache.lucene.util.InfoStream;
|
|||
public class MergeState {
|
||||
|
||||
public static class IndexReaderAndLiveDocs {
|
||||
public final AtomicIndexReader reader;
|
||||
public final AtomicReader reader;
|
||||
public final Bits liveDocs;
|
||||
|
||||
public IndexReaderAndLiveDocs(AtomicIndexReader reader, Bits liveDocs) {
|
||||
public IndexReaderAndLiveDocs(AtomicReader reader, Bits liveDocs) {
|
||||
this.reader = reader;
|
||||
this.liveDocs = liveDocs;
|
||||
}
|
||||
|
|
|
@ -43,11 +43,11 @@ public class MultiDocValues extends DocValues {
|
|||
|
||||
private static DocValuesPuller DEFAULT_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);
|
||||
}
|
||||
|
||||
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
|
||||
FieldInfos fieldInfos = reader.getFieldInfos();
|
||||
FieldInfo fieldInfo = fieldInfos.fieldInfo(field);
|
||||
|
@ -69,11 +69,11 @@ public class MultiDocValues extends DocValues {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean stopLoadingOnNull(AtomicIndexReader reader, String field) throws IOException {
|
||||
public boolean stopLoadingOnNull(AtomicReader reader, String field) throws IOException {
|
||||
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 {
|
||||
if (r instanceof AtomicIndexReader) {
|
||||
if (r instanceof AtomicReader) {
|
||||
// already an atomic reader
|
||||
return puller.pull((AtomicIndexReader) r, field);
|
||||
return puller.pull((AtomicReader) r, field);
|
||||
}
|
||||
assert r instanceof CompositeIndexReader;
|
||||
final IndexReader[] subs = ((CompositeIndexReader) r).getSequentialSubReaders();
|
||||
assert r instanceof CompositeReader;
|
||||
final IndexReader[] subs = ((CompositeReader) r).getSequentialSubReaders();
|
||||
if (subs.length == 0) {
|
||||
// no fields
|
||||
return null;
|
||||
|
@ -138,7 +138,7 @@ public class MultiDocValues extends DocValues {
|
|||
new ReaderUtil.Gather(r) {
|
||||
boolean stop = false;
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) throws IOException {
|
||||
protected void add(int base, AtomicReader r) throws IOException {
|
||||
if (stop) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,12 +61,12 @@ public final class MultiFields extends Fields {
|
|||
* Gather}) and iterate through them
|
||||
* yourself. */
|
||||
public static Fields getFields(IndexReader r) throws IOException {
|
||||
if (r instanceof AtomicIndexReader) {
|
||||
if (r instanceof AtomicReader) {
|
||||
// already an atomic reader
|
||||
return ((AtomicIndexReader) r).fields();
|
||||
return ((AtomicReader) r).fields();
|
||||
}
|
||||
assert r instanceof CompositeIndexReader;
|
||||
final IndexReader[] subs = ((CompositeIndexReader) r).getSequentialSubReaders();
|
||||
assert r instanceof CompositeReader;
|
||||
final IndexReader[] subs = ((CompositeReader) r).getSequentialSubReaders();
|
||||
if (subs.length == 0) {
|
||||
// no fields
|
||||
return null;
|
||||
|
@ -76,7 +76,7 @@ public final class MultiFields extends Fields {
|
|||
|
||||
new ReaderUtil.Gather(r) {
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) throws IOException {
|
||||
protected void add(int base, AtomicReader r) throws IOException {
|
||||
final Fields f = r.fields();
|
||||
if (f != null) {
|
||||
fields.add(f);
|
||||
|
@ -104,7 +104,7 @@ public final class MultiFields extends Fields {
|
|||
try {
|
||||
final int maxDoc = new ReaderUtil.Gather(r) {
|
||||
@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
|
||||
liveDocs.add(r.getLiveDocs());
|
||||
starts.add(base);
|
||||
|
@ -246,10 +246,10 @@ public final class MultiFields extends Fields {
|
|||
/** Call this to get the (merged) FieldInfos for a
|
||||
* composite 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);
|
||||
final FieldInfos fieldInfos = new FieldInfos();
|
||||
for(AtomicIndexReader subReader : subReaders) {
|
||||
for(AtomicReader subReader : subReaders) {
|
||||
fieldInfos.add(subReader.getFieldInfos());
|
||||
}
|
||||
return fieldInfos;
|
||||
|
|
|
@ -41,13 +41,13 @@ import org.apache.lucene.util.BytesRef;
|
|||
* same order to the other indexes. <em>Failure to do so will result in
|
||||
* undefined behavior</em>.
|
||||
*/
|
||||
public class ParallelReader extends AtomicIndexReader {
|
||||
private List<AtomicIndexReader> readers = new ArrayList<AtomicIndexReader>();
|
||||
public class ParallelReader extends AtomicReader {
|
||||
private List<AtomicReader> readers = new ArrayList<AtomicReader>();
|
||||
private List<Boolean> decrefOnClose = new ArrayList<Boolean>(); // remember which subreaders to decRef on close
|
||||
boolean incRefReaders = false;
|
||||
private SortedMap<String,AtomicIndexReader> fieldToReader = new TreeMap<String,AtomicIndexReader>();
|
||||
private Map<AtomicIndexReader,Collection<String>> readerToFields = new HashMap<AtomicIndexReader,Collection<String>>();
|
||||
private List<AtomicIndexReader> storedFieldReaders = new ArrayList<AtomicIndexReader>();
|
||||
private SortedMap<String,AtomicReader> fieldToReader = new TreeMap<String,AtomicReader>();
|
||||
private Map<AtomicReader,Collection<String>> readerToFields = new HashMap<AtomicReader,Collection<String>>();
|
||||
private List<AtomicReader> storedFieldReaders = new ArrayList<AtomicReader>();
|
||||
private Map<String, DocValues> normsCache = new HashMap<String,DocValues>();
|
||||
private int maxDoc;
|
||||
private int numDocs;
|
||||
|
@ -75,7 +75,7 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder buffer = new StringBuilder("ParallelReader(");
|
||||
final Iterator<AtomicIndexReader> iter = readers.iterator();
|
||||
final Iterator<AtomicReader> iter = readers.iterator();
|
||||
if (iter.hasNext()) {
|
||||
buffer.append(iter.next());
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
/** Add an AtomicIndexReader.
|
||||
* @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();
|
||||
add(reader, false);
|
||||
}
|
||||
|
@ -101,10 +101,10 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
* @throws IllegalArgumentException if not all indexes contain the same number
|
||||
* of documents
|
||||
* @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
|
||||
*/
|
||||
public void add(AtomicIndexReader reader, boolean ignoreStoredFields)
|
||||
public void add(AtomicReader reader, boolean ignoreStoredFields)
|
||||
throws IOException {
|
||||
|
||||
ensureOpen();
|
||||
|
@ -233,7 +233,7 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
@Override
|
||||
public void document(int docID, StoredFieldVisitor visitor) throws CorruptIndexException, IOException {
|
||||
ensureOpen();
|
||||
for (final AtomicIndexReader reader: storedFieldReaders) {
|
||||
for (final AtomicReader reader: storedFieldReaders) {
|
||||
reader.document(docID, visitor);
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
public Fields getTermVectors(int docID) throws IOException {
|
||||
ensureOpen();
|
||||
ParallelFields fields = new ParallelFields();
|
||||
for (Map.Entry<String,AtomicIndexReader> ent : fieldToReader.entrySet()) {
|
||||
for (Map.Entry<String,AtomicReader> ent : fieldToReader.entrySet()) {
|
||||
String fieldName = ent.getKey();
|
||||
Terms vector = ent.getValue().getTermVector(docID, fieldName);
|
||||
if (vector != null) {
|
||||
|
@ -257,20 +257,20 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
@Override
|
||||
public boolean hasNorms(String field) throws IOException {
|
||||
ensureOpen();
|
||||
AtomicIndexReader reader = fieldToReader.get(field);
|
||||
AtomicReader reader = fieldToReader.get(field);
|
||||
return reader==null ? false : reader.hasNorms(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int docFreq(String field, BytesRef term) throws IOException {
|
||||
ensureOpen();
|
||||
AtomicIndexReader reader = fieldToReader.get(field);
|
||||
AtomicReader reader = fieldToReader.get(field);
|
||||
return reader == null? 0 : reader.docFreq(field, term);
|
||||
}
|
||||
|
||||
// for testing
|
||||
AtomicIndexReader[] getSubReaders() {
|
||||
return readers.toArray(new AtomicIndexReader[readers.size()]);
|
||||
AtomicReader[] getSubReaders() {
|
||||
return readers.toArray(new AtomicReader[readers.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -287,7 +287,7 @@ public class ParallelReader extends AtomicIndexReader {
|
|||
// TODO: I suspect this is completely untested!!!!!
|
||||
@Override
|
||||
public DocValues docValues(String field) throws IOException {
|
||||
AtomicIndexReader reader = fieldToReader.get(field);
|
||||
AtomicReader reader = fieldToReader.get(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 {
|
||||
DocValues values = normsCache.get(field);
|
||||
if (values == null) {
|
||||
AtomicIndexReader reader = fieldToReader.get(field);
|
||||
AtomicReader reader = fieldToReader.get(field);
|
||||
values = reader == null ? null : reader.normValues(field);
|
||||
normsCache.put(field, values);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ final class SegmentMerger {
|
|||
try {
|
||||
new ReaderUtil.Gather(reader) {
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) {
|
||||
protected void add(int base, AtomicReader r) {
|
||||
mergeState.readers.add(new MergeState.IndexReaderAndLiveDocs(r, r.getLiveDocs()));
|
||||
}
|
||||
}.run();
|
||||
|
@ -201,7 +201,7 @@ final class SegmentMerger {
|
|||
Map<FieldInfo,TypePromoter> normValuesTypes = new HashMap<FieldInfo,TypePromoter>();
|
||||
|
||||
for (MergeState.IndexReaderAndLiveDocs readerAndLiveDocs : mergeState.readers) {
|
||||
final AtomicIndexReader reader = readerAndLiveDocs.reader;
|
||||
final AtomicReader reader = readerAndLiveDocs.reader;
|
||||
FieldInfos readerFieldInfos = reader.getFieldInfos();
|
||||
for (FieldInfo fi : readerFieldInfos) {
|
||||
FieldInfo merged = mergeState.fieldInfos.add(fi);
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.lucene.util.Bits;
|
|||
/**
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public final class SegmentReader extends AtomicIndexReader {
|
||||
public final class SegmentReader extends AtomicReader {
|
||||
|
||||
private final SegmentInfo si;
|
||||
private final Bits liveDocs;
|
||||
|
|
|
@ -50,27 +50,27 @@ import org.apache.lucene.index.MultiReader; // javadoc
|
|||
* 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 Fields fields;
|
||||
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,
|
||||
* it is returned unchanged, otherwise wrapped by this class.
|
||||
*/
|
||||
public static AtomicIndexReader wrap(IndexReader reader) throws IOException {
|
||||
if (reader instanceof CompositeIndexReader) {
|
||||
return new SlowCompositeReaderWrapper((CompositeIndexReader) reader);
|
||||
public static AtomicReader wrap(IndexReader reader) throws IOException {
|
||||
if (reader instanceof CompositeReader) {
|
||||
return new SlowCompositeReaderWrapper((CompositeReader) reader);
|
||||
} else {
|
||||
assert reader instanceof AtomicIndexReader;
|
||||
return (AtomicIndexReader) reader;
|
||||
assert reader instanceof AtomicReader;
|
||||
return (AtomicReader) reader;
|
||||
}
|
||||
}
|
||||
|
||||
public SlowCompositeReaderWrapper(CompositeIndexReader reader) throws IOException {
|
||||
public SlowCompositeReaderWrapper(CompositeReader reader) throws IOException {
|
||||
super();
|
||||
in = reader;
|
||||
fields = MultiFields.getFields(in);
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
import java.util.*;
|
||||
|
||||
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.Term;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
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.BooleanQuery.BooleanWeight;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* 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 java.io.IOException;
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Collections;
|
|||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.apache.lucene.index.AtomicIndexReader;
|
||||
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.util.FixedBitSet;
|
||||
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
|
||||
* a {@link FixedBitSet}.
|
||||
*/
|
||||
protected DocIdSet docIdSetToCache(DocIdSet docIdSet, AtomicIndexReader reader) throws IOException {
|
||||
protected DocIdSet docIdSetToCache(DocIdSet docIdSet, AtomicReader reader) throws IOException {
|
||||
if (docIdSet == null) {
|
||||
// this is better than returning null, as the nonnull result can be cached
|
||||
return DocIdSet.EMPTY_DOCIDSET;
|
||||
|
@ -102,7 +102,7 @@ public class CachingWrapperFilter extends Filter {
|
|||
|
||||
@Override
|
||||
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;
|
||||
// if Lucene passes in more interesting acceptDocs in
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
|
||||
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.util.Bits;
|
||||
import org.apache.lucene.util.ToStringUtils;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
|
||||
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.util.Bits;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.text.DecimalFormat;
|
|||
import org.apache.lucene.analysis.NumericTokenStream; // for javadocs
|
||||
import org.apache.lucene.document.NumericField; // for javadocs
|
||||
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.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
@ -63,7 +63,7 @@ public interface FieldCache {
|
|||
}
|
||||
|
||||
/** 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 {
|
||||
/** Return a single Byte representation of this field's value. */
|
||||
|
@ -71,7 +71,7 @@ public interface FieldCache {
|
|||
}
|
||||
|
||||
/** 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 {
|
||||
/** Return a short representation of this field's value. */
|
||||
|
@ -79,7 +79,7 @@ public interface FieldCache {
|
|||
}
|
||||
|
||||
/** 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 {
|
||||
/** Return an integer representation of this field's value. */
|
||||
|
@ -87,7 +87,7 @@ public interface FieldCache {
|
|||
}
|
||||
|
||||
/** 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 {
|
||||
/** Return an float representation of this field's value. */
|
||||
|
@ -95,7 +95,7 @@ public interface FieldCache {
|
|||
}
|
||||
|
||||
/** 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 {
|
||||
/** Return an long representation of this field's value. */
|
||||
|
@ -103,7 +103,7 @@ public interface FieldCache {
|
|||
}
|
||||
|
||||
/** 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 {
|
||||
/** 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
|
||||
* does have a value for this field.
|
||||
*/
|
||||
public Bits getDocsWithField(AtomicIndexReader reader, String field)
|
||||
public Bits getDocsWithField(AtomicReader reader, String field)
|
||||
throws IOException;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/** 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.
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
@ -435,7 +435,7 @@ public interface FieldCache {
|
|||
* @return The values in the given field for each document.
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
@ -452,7 +452,7 @@ public interface FieldCache {
|
|||
* @return The values in the given field for each document.
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
@ -468,7 +468,7 @@ public interface FieldCache {
|
|||
* @return The values in the given field for each document.
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
@ -485,7 +485,7 @@ public interface FieldCache {
|
|||
* @return The values in the given field for each document.
|
||||
* @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;
|
||||
|
||||
/** Returned by {@link #getTerms} */
|
||||
|
@ -513,15 +513,15 @@ public interface FieldCache {
|
|||
* @return The values in the given field for each document.
|
||||
* @throws IOException If any error occurs.
|
||||
*/
|
||||
public DocTerms getTerms (AtomicIndexReader reader, String field)
|
||||
public DocTerms getTerms (AtomicReader reader, String field)
|
||||
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
|
||||
* faster lookups (default is "true"). Note that the
|
||||
* first call for a given reader and field "wins",
|
||||
* 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;
|
||||
|
||||
/** Returned by {@link #getTermsIndex} */
|
||||
|
@ -589,16 +589,16 @@ public interface FieldCache {
|
|||
* @return The values in the given field for each document.
|
||||
* @throws IOException If any error occurs.
|
||||
*/
|
||||
public DocTermsIndex getTermsIndex (AtomicIndexReader reader, String field)
|
||||
public DocTermsIndex getTermsIndex (AtomicReader reader, String field)
|
||||
throws IOException;
|
||||
|
||||
/** 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
|
||||
* faster lookups (default is "true"). Note that the
|
||||
* first call for a given reader and field "wins",
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
@ -611,7 +611,7 @@ public interface FieldCache {
|
|||
* @return a {@link DocTermOrds} instance
|
||||
* @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.
|
||||
|
@ -705,7 +705,7 @@ public interface FieldCache {
|
|||
* top-level reader, it usually will have no effect as
|
||||
* 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
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.WeakHashMap;
|
|||
import org.apache.lucene.index.DocTermOrds;
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
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.OrdTermState;
|
||||
import org.apache.lucene.index.SegmentReader;
|
||||
|
@ -75,7 +75,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
init();
|
||||
}
|
||||
|
||||
public synchronized void purge(AtomicIndexReader r) {
|
||||
public synchronized void purge(AtomicReader r) {
|
||||
for(Cache c : caches.values()) {
|
||||
c.purge(r);
|
||||
}
|
||||
|
@ -154,23 +154,23 @@ class FieldCacheImpl implements FieldCache {
|
|||
};
|
||||
|
||||
// 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
|
||||
public void onClose(IndexReader owner) {
|
||||
assert owner instanceof AtomicIndexReader;
|
||||
FieldCacheImpl.this.purge((AtomicIndexReader) owner);
|
||||
assert owner instanceof AtomicReader;
|
||||
FieldCacheImpl.this.purge((AtomicReader) owner);
|
||||
}
|
||||
};
|
||||
|
||||
private void initReader(AtomicIndexReader reader) {
|
||||
private void initReader(AtomicReader reader) {
|
||||
if (reader instanceof SegmentReader) {
|
||||
((SegmentReader) reader).addCoreClosedListener(purgeCore);
|
||||
} else {
|
||||
// we have a slow reader of some sort, try to register a purge event
|
||||
// rather than relying on gc:
|
||||
Object key = reader.getCoreCacheKey();
|
||||
if (key instanceof AtomicIndexReader) {
|
||||
((AtomicIndexReader)key).addReaderClosedListener(purgeReader);
|
||||
if (key instanceof AtomicReader) {
|
||||
((AtomicReader)key).addReaderClosedListener(purgeReader);
|
||||
} else {
|
||||
// last chance
|
||||
reader.addReaderClosedListener(purgeReader);
|
||||
|
@ -189,11 +189,11 @@ class FieldCacheImpl implements FieldCache {
|
|||
|
||||
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;
|
||||
|
||||
/** Remove this reader from the cache, if present. */
|
||||
public void purge(AtomicIndexReader r) {
|
||||
public void purge(AtomicReader r) {
|
||||
Object readerKey = r.getCoreCacheKey();
|
||||
synchronized(readerCache) {
|
||||
readerCache.remove(readerKey);
|
||||
|
@ -202,7 +202,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
|
||||
/** Sets the key to the value for the provided reader;
|
||||
* 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();
|
||||
synchronized (readerCache) {
|
||||
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;
|
||||
Object value;
|
||||
final Object readerKey = reader.getCoreCacheKey();
|
||||
|
@ -319,12 +319,12 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return (byte[]) caches.get(Byte.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
super(wrapper);
|
||||
}
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
String field = entryKey.field;
|
||||
ByteParser parser = (ByteParser) entryKey.custom;
|
||||
|
@ -391,12 +391,12 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return (short[]) caches.get(Short.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
String field = entryKey.field;
|
||||
ShortParser parser = (ShortParser) entryKey.custom;
|
||||
|
@ -464,7 +464,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
// 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 Bits bits;
|
||||
if (docsWithField == null) {
|
||||
|
@ -485,12 +485,12 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return (int[]) caches.get(Integer.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
String field = entryKey.field;
|
||||
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 {
|
||||
return (Bits) caches.get(DocsWithFieldCache.class).get(reader, new Entry(field, null), false);
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
throws IOException {
|
||||
final String field = entryKey.field;
|
||||
FixedBitSet res = null;
|
||||
|
@ -633,13 +633,13 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
// inherit javadocs
|
||||
public float[] getFloats (AtomicIndexReader reader, String field, boolean setDocsWithField)
|
||||
public float[] getFloats (AtomicReader reader, String field, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
return getFloats(reader, field, null, setDocsWithField);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
|
||||
return (float[]) caches.get(Float.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
|
||||
|
@ -651,7 +651,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
String field = entryKey.field;
|
||||
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);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return (long[]) caches.get(Long.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
String field = entryKey.field;
|
||||
FieldCache.LongParser parser = (FieldCache.LongParser) entryKey.custom;
|
||||
|
@ -811,13 +811,13 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
// inherit javadocs
|
||||
public double[] getDoubles(AtomicIndexReader reader, String field, boolean setDocsWithField)
|
||||
public double[] getDoubles(AtomicReader reader, String field, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
return getDoubles(reader, field, null, setDocsWithField);
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return (double[]) caches.get(Double.TYPE).get(reader, new Entry(field, parser), setDocsWithField);
|
||||
}
|
||||
|
@ -828,7 +828,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField)
|
||||
throws IOException {
|
||||
String field = entryKey.field;
|
||||
FieldCache.DoubleParser parser = (FieldCache.DoubleParser) entryKey.custom;
|
||||
|
@ -1073,11 +1073,11 @@ class FieldCacheImpl implements FieldCache {
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
throws IOException {
|
||||
|
||||
Terms terms = reader.terms(entryKey.field);
|
||||
|
@ -1218,11 +1218,11 @@ class FieldCacheImpl implements FieldCache {
|
|||
|
||||
// TODO: this if DocTermsIndex was already created, we
|
||||
// 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1232,7 +1232,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
throws IOException {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1316,7 +1316,7 @@ class FieldCacheImpl implements FieldCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object createValue(AtomicIndexReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
protected Object createValue(AtomicReader reader, Entry entryKey, boolean setDocsWithField /* ignored */)
|
||||
throws IOException {
|
||||
return new DocTermOrds(reader, entryKey.field);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
import java.io.IOException;
|
||||
|
||||
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.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.DocsEnum; // javadoc @link
|
||||
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.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search;
|
|||
import java.io.IOException;
|
||||
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.IndexReader;
|
||||
import org.apache.lucene.search.FieldCache.ByteParser;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
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.MatchAllBits;
|
||||
import org.apache.lucene.util.Bits.MatchNoBits;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search;
|
|||
import java.io.IOException;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
|
||||
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.util.Bits;
|
||||
import org.apache.lucene.util.ToStringUtils;
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||
|
||||
import org.apache.lucene.document.Document;
|
||||
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;
|
||||
import org.apache.lucene.index.MultiFields;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search;
|
|||
*/
|
||||
|
||||
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.util.ToStringUtils;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
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.Scorer;
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.*;
|
|||
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
import org.apache.lucene.index.DocsEnum;
|
||||
import org.apache.lucene.index.AtomicIndexReader;
|
||||
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.IndexReader.ReaderContext;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
@ -178,7 +178,7 @@ public class MultiPhraseQuery extends Query {
|
|||
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
|
||||
boolean topScorer, Bits acceptDocs) throws IOException {
|
||||
assert !termArrays.isEmpty();
|
||||
final AtomicIndexReader reader = context.reader();
|
||||
final AtomicReader reader = context.reader();
|
||||
final Bits liveDocs = acceptDocs;
|
||||
|
||||
PhraseQuery.PostingsAndFreq[] postingsFreqs = new PhraseQuery.PostingsAndFreq[termArrays.size()];
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.DocsEnum;
|
||||
import org.apache.lucene.index.Fields;
|
||||
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.AtomicIndexReader;
|
||||
import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
import org.apache.lucene.util.FixedBitSet;
|
||||
|
@ -83,7 +83,7 @@ public class MultiTermQueryWrapperFilter<Q extends MultiTermQuery> extends Filte
|
|||
*/
|
||||
@Override
|
||||
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {
|
||||
final AtomicIndexReader reader = context.reader();
|
||||
final AtomicReader reader = context.reader();
|
||||
final Fields fields = reader.fields();
|
||||
if (fields == null) {
|
||||
// reader has no fields
|
||||
|
|
|
@ -22,10 +22,10 @@ import java.util.ArrayList;
|
|||
import java.util.Set;
|
||||
|
||||
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;
|
||||
import org.apache.lucene.index.AtomicIndexReader;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.index.TermState;
|
||||
import org.apache.lucene.index.Terms;
|
||||
|
@ -220,7 +220,7 @@ public class PhraseQuery extends Query {
|
|||
public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder,
|
||||
boolean topScorer, Bits acceptDocs) throws IOException {
|
||||
assert !terms.isEmpty();
|
||||
final AtomicIndexReader reader = context.reader();
|
||||
final AtomicReader reader = context.reader();
|
||||
final Bits liveDocs = acceptDocs;
|
||||
PostingsAndFreq[] postingsFreqs = new PostingsAndFreq[terms.size()];
|
||||
|
||||
|
@ -271,7 +271,7 @@ public class PhraseQuery extends Query {
|
|||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
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
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.index.Terms;
|
||||
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.util.AttributeSource;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -21,9 +21,9 @@ import java.io.IOException;
|
|||
import java.util.Set;
|
||||
|
||||
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.AtomicIndexReader;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.index.TermState;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
|
@ -117,7 +117,7 @@ public class TermQuery extends Query {
|
|||
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
|
||||
//System.out.println("TQ.termNotInReader reader=" + reader + " term=" + field + ":" + bytes.utf8ToString());
|
||||
return reader.docFreq(field, bytes) == 0;
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
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.ThreadInterruptedException;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
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.util.PriorityQueue;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.lucene.search;
|
|||
|
||||
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,
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search;
|
|||
* 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.
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search;
|
|||
import java.io.IOException;
|
||||
|
||||
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.search.similarities.SimilarityProvider;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search.payloads;
|
|||
* 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.Explanation;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Map;
|
|||
import java.util.TreeSet;
|
||||
|
||||
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.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search.payloads;
|
|||
* 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.DocsAndPositionsEnum;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.DocValues;
|
||||
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.search.CollectionStatistics;
|
||||
import org.apache.lucene.search.Explanation;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search.similarities;
|
|||
import java.io.IOException;
|
||||
|
||||
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.search.CollectionStatistics;
|
||||
import org.apache.lucene.search.Explanation;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.IOException;
|
|||
import org.apache.lucene.document.DocValuesField; // javadoc
|
||||
import org.apache.lucene.index.FieldInvertState;
|
||||
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.Terms; // javadoc
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.DocValues;
|
||||
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.search.CollectionStatistics;
|
||||
import org.apache.lucene.search.Explanation;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.lucene.search.similarities;
|
|||
import java.io.IOException;
|
||||
|
||||
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.Explanation;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
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.search.Query;
|
||||
import org.apache.lucene.search.Weight;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
|
|||
*/
|
||||
|
||||
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.Bits;
|
||||
import org.apache.lucene.util.TermContext;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
|
|||
*/
|
||||
|
||||
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.PriorityQueue;
|
||||
import org.apache.lucene.util.TermContext;
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
import java.util.Map;
|
||||
|
||||
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.search.MultiTermQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Set;
|
|||
|
||||
|
||||
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.search.Query;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
|
|||
*/
|
||||
|
||||
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.search.Query;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
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.util.Bits;
|
||||
import org.apache.lucene.util.PriorityQueue;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.lucene.search.spans;
|
|||
|
||||
|
||||
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.search.Query;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.lucene.search.spans;
|
|||
import java.io.IOException;
|
||||
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.search.Query;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search.spans;
|
|||
* 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.Term;
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.lucene.search.spans;
|
|||
* 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.Term;
|
||||
import org.apache.lucene.search.*;
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
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.CacheEntry;
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
import org.apache.lucene.index.CompositeIndexReader;
|
||||
import org.apache.lucene.index.CompositeIndexReader.CompositeReaderContext;
|
||||
import org.apache.lucene.index.AtomicIndexReader;
|
||||
import org.apache.lucene.index.AtomicIndexReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.CompositeReader;
|
||||
import org.apache.lucene.index.CompositeReader.CompositeReaderContext;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.AtomicReader.AtomicReaderContext;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexReader.ReaderContext;
|
||||
|
||||
|
@ -68,11 +68,11 @@ public final class ReaderUtil {
|
|||
* @param reader
|
||||
*/
|
||||
|
||||
public static void gatherSubReaders(final List<AtomicIndexReader> allSubReaders, IndexReader reader) {
|
||||
public static void gatherSubReaders(final List<AtomicReader> allSubReaders, IndexReader reader) {
|
||||
try {
|
||||
new Gather(reader) {
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) {
|
||||
protected void add(int base, AtomicReader r) {
|
||||
allSubReaders.add(r);
|
||||
}
|
||||
}.run();
|
||||
|
@ -103,13 +103,13 @@ public final class ReaderUtil {
|
|||
}
|
||||
|
||||
private int run(int base, IndexReader reader) throws IOException {
|
||||
if (reader instanceof AtomicIndexReader) {
|
||||
if (reader instanceof AtomicReader) {
|
||||
// atomic reader
|
||||
add(base, (AtomicIndexReader) reader);
|
||||
add(base, (AtomicReader) reader);
|
||||
base += reader.maxDoc();
|
||||
} else {
|
||||
assert reader instanceof CompositeIndexReader : "must be a composite reader";
|
||||
IndexReader[] subReaders = ((CompositeIndexReader) reader).getSequentialSubReaders();
|
||||
assert reader instanceof CompositeReader : "must be a composite reader";
|
||||
IndexReader[] subReaders = ((CompositeReader) reader).getSequentialSubReaders();
|
||||
for (int i = 0; i < subReaders.length; i++) {
|
||||
base = run(base, subReaders[i]);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public final class ReaderUtil {
|
|||
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) {
|
||||
|
@ -140,13 +140,13 @@ public final class ReaderUtil {
|
|||
}
|
||||
|
||||
private ReaderContext build(CompositeReaderContext parent, IndexReader reader, int ord, int docBase) {
|
||||
if (reader instanceof AtomicIndexReader) {
|
||||
AtomicReaderContext atomic = new AtomicReaderContext(parent, (AtomicIndexReader) reader, ord, docBase, leafOrd, leafDocBase);
|
||||
if (reader instanceof AtomicReader) {
|
||||
AtomicReaderContext atomic = new AtomicReaderContext(parent, (AtomicReader) reader, ord, docBase, leafOrd, leafDocBase);
|
||||
leaves[leafOrd++] = atomic;
|
||||
leafDocBase += reader.maxDoc();
|
||||
return atomic;
|
||||
} else {
|
||||
CompositeIndexReader cr = (CompositeIndexReader) reader;
|
||||
CompositeReader cr = (CompositeReader) reader;
|
||||
IndexReader[] sequentialSubReaders = cr.getSequentialSubReaders();
|
||||
ReaderContext[] children = new ReaderContext[sequentialSubReaders.length];
|
||||
final CompositeReaderContext newParent;
|
||||
|
@ -170,7 +170,7 @@ public final class ReaderUtil {
|
|||
try {
|
||||
new Gather(reader) {
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) {
|
||||
protected void add(int base, AtomicReader r) {
|
||||
numLeaves[0]++;
|
||||
}
|
||||
}.run();
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
|||
import java.util.Arrays;
|
||||
|
||||
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;
|
||||
import org.apache.lucene.index.Term;
|
||||
|
|
|
@ -455,7 +455,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
|
|||
|
||||
conf.setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
|
||||
@Override
|
||||
public void warm(AtomicIndexReader reader) throws IOException {
|
||||
public void warm(AtomicReader reader) throws IOException {
|
||||
if (VERBOSE) {
|
||||
System.out.println("TEST: now warm merged reader=" + reader);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.io.IOException;
|
||||
|
||||
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.util.Bits;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Random;
|
|||
import junit.framework.Assert;
|
||||
|
||||
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.util.LuceneTestCase;
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ import junit.framework.Assert;
|
|||
|
||||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
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.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.IndexWriterConfig;
|
||||
import org.apache.lucene.index.MultiReader;
|
||||
|
@ -239,7 +239,7 @@ public class QueryUtils {
|
|||
// FUTURE: ensure scorer.doc()==-1
|
||||
|
||||
final float maxDiff = 1e-5f;
|
||||
final AtomicIndexReader lastReader[] = {null};
|
||||
final AtomicReader lastReader[] = {null};
|
||||
|
||||
s.search(q, new Collector() {
|
||||
private Scorer sc;
|
||||
|
@ -301,7 +301,7 @@ public class QueryUtils {
|
|||
// confirm that skipping beyond the last doc, on the
|
||||
// previous reader, hits NO_MORE_DOCS
|
||||
if (lastReader[0] != null) {
|
||||
final AtomicIndexReader previousReader = lastReader[0];
|
||||
final AtomicReader previousReader = lastReader[0];
|
||||
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
|
||||
Weight w = indexSearcher.createNormalizedWeight(q);
|
||||
AtomicReaderContext ctx = (AtomicReaderContext)indexSearcher.getTopReaderContext();
|
||||
|
@ -327,7 +327,7 @@ public class QueryUtils {
|
|||
if (lastReader[0] != null) {
|
||||
// confirm that skipping beyond the last doc, on the
|
||||
// previous reader, hits NO_MORE_DOCS
|
||||
final AtomicIndexReader previousReader = lastReader[0];
|
||||
final AtomicReader previousReader = lastReader[0];
|
||||
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader, false);
|
||||
Weight w = indexSearcher.createNormalizedWeight(q);
|
||||
AtomicReaderContext ctx = previousReader.getTopReaderContext();
|
||||
|
@ -345,7 +345,7 @@ public class QueryUtils {
|
|||
//System.out.println("checkFirstSkipTo: "+q);
|
||||
final float maxDiff = 1e-3f;
|
||||
final int lastDoc[] = {-1};
|
||||
final AtomicIndexReader lastReader[] = {null};
|
||||
final AtomicReader lastReader[] = {null};
|
||||
final AtomicReaderContext[] context = ReaderUtil.leaves(s.getTopReaderContext());
|
||||
s.search(q,new Collector() {
|
||||
private Scorer scorer;
|
||||
|
@ -386,7 +386,7 @@ public class QueryUtils {
|
|||
// confirm that skipping beyond the last doc, on the
|
||||
// previous reader, hits NO_MORE_DOCS
|
||||
if (lastReader[0] != null) {
|
||||
final AtomicIndexReader previousReader = lastReader[0];
|
||||
final AtomicReader previousReader = lastReader[0];
|
||||
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
|
||||
Weight w = indexSearcher.createNormalizedWeight(q);
|
||||
Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), true, false, previousReader.getLiveDocs());
|
||||
|
@ -410,7 +410,7 @@ public class QueryUtils {
|
|||
if (lastReader[0] != null) {
|
||||
// confirm that skipping beyond the last doc, on the
|
||||
// previous reader, hits NO_MORE_DOCS
|
||||
final AtomicIndexReader previousReader = lastReader[0];
|
||||
final AtomicReader previousReader = lastReader[0];
|
||||
IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
|
||||
Weight w = indexSearcher.createNormalizedWeight(q);
|
||||
Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), true, false, previousReader.getLiveDocs());
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Random;
|
|||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
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.DocsEnum;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
@ -53,7 +53,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
|
|||
DirectoryReader open = DirectoryReader.open(dir);
|
||||
new ReaderUtil.Gather(open) {
|
||||
@Override
|
||||
protected void add(int base, AtomicIndexReader r) throws IOException {
|
||||
protected void add(int base, AtomicReader r) throws IOException {
|
||||
Terms terms = r.terms("body");
|
||||
TermsEnum iterator = terms.iterator(null);
|
||||
IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
|
||||
|
@ -82,7 +82,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
|
|||
DirectoryReader open = DirectoryReader.open(dir);
|
||||
IndexReader[] sequentialSubReaders = open.getSequentialSubReaders();
|
||||
for (IndexReader indexReader : sequentialSubReaders) {
|
||||
Terms terms = ((AtomicIndexReader) indexReader).terms("body");
|
||||
Terms terms = ((AtomicReader) indexReader).terms("body");
|
||||
TermsEnum iterator = terms.iterator(null);
|
||||
IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
|
||||
MatchNoBits bits = new Bits.MatchNoBits(open.maxDoc());
|
||||
|
@ -130,7 +130,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
|
|||
IndexReader[] sequentialSubReaders2 = secondReader.getSequentialSubReaders();
|
||||
|
||||
for (IndexReader indexReader : sequentialSubReaders) {
|
||||
Terms terms = ((AtomicIndexReader) indexReader).terms("body");
|
||||
Terms terms = ((AtomicReader) indexReader).terms("body");
|
||||
TermsEnum iterator = terms.iterator(null);
|
||||
IdentityHashMap<DocsEnum, Boolean> enums = new IdentityHashMap<DocsEnum, Boolean>();
|
||||
MatchNoBits bits = new Bits.MatchNoBits(firstReader.maxDoc());
|
||||
|
@ -159,7 +159,7 @@ public class TestReuseDocsEnum extends LuceneTestCase {
|
|||
if (random.nextInt(10) == 0) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.codecs.nestedpulsing.NestedPulsingPostingsFormat;
|
|||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
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.DirectoryReader;
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
|
@ -56,7 +56,7 @@ public class TestPulsingReuse extends LuceneTestCase {
|
|||
DirectoryReader ir = iw.getReader();
|
||||
iw.close();
|
||||
|
||||
AtomicIndexReader segment = getOnlySegmentReader(ir);
|
||||
AtomicReader segment = getOnlySegmentReader(ir);
|
||||
DocsEnum reuse = null;
|
||||
Map<DocsEnum,Boolean> allEnums = new IdentityHashMap<DocsEnum,Boolean>();
|
||||
TermsEnum te = segment.terms("foo").iterator(null);
|
||||
|
@ -98,7 +98,7 @@ public class TestPulsingReuse extends LuceneTestCase {
|
|||
DirectoryReader ir = iw.getReader();
|
||||
iw.close();
|
||||
|
||||
AtomicIndexReader segment = getOnlySegmentReader(ir);
|
||||
AtomicReader segment = getOnlySegmentReader(ir);
|
||||
DocsEnum reuse = null;
|
||||
Map<DocsEnum,Boolean> allEnums = new IdentityHashMap<DocsEnum,Boolean>();
|
||||
TermsEnum te = segment.terms("foo").iterator(null);
|
||||
|
|
|
@ -1288,7 +1288,7 @@ public class TestAddIndexes extends LuceneTestCase {
|
|||
w.forceMerge(1);
|
||||
DirectoryReader r3 = w.getReader();
|
||||
w.close();
|
||||
AtomicIndexReader sr = getOnlySegmentReader(r3);
|
||||
AtomicReader sr = getOnlySegmentReader(r3);
|
||||
assertEquals(2, sr.numDocs());
|
||||
DocValues docValues = sr.docValues("dv");
|
||||
assertNotNull(docValues);
|
||||
|
|
|
@ -79,7 +79,7 @@ public class TestCustomNorms extends LuceneTestCase {
|
|||
}
|
||||
writer.commit();
|
||||
writer.close();
|
||||
AtomicIndexReader open = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir));
|
||||
AtomicReader open = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir));
|
||||
DocValues normValues = open.normValues(floatTestField);
|
||||
assertNotNull(normValues);
|
||||
Source source = normValues.getSource();
|
||||
|
|
|
@ -160,7 +160,7 @@ public class TestDocTermOrds extends LuceneTestCase {
|
|||
if (VERBOSE) {
|
||||
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
|
||||
|
@ -168,7 +168,7 @@ public class TestDocTermOrds extends LuceneTestCase {
|
|||
if (VERBOSE) {
|
||||
System.out.println("TEST: top reader");
|
||||
}
|
||||
AtomicIndexReader slowR = SlowCompositeReaderWrapper.wrap(r);
|
||||
AtomicReader slowR = SlowCompositeReaderWrapper.wrap(r);
|
||||
verify(slowR, idToOrds, termsArray, null);
|
||||
|
||||
FieldCache.DEFAULT.purge(slowR);
|
||||
|
@ -253,7 +253,7 @@ public class TestDocTermOrds extends LuceneTestCase {
|
|||
System.out.println("TEST: reader=" + r);
|
||||
}
|
||||
|
||||
AtomicIndexReader slowR = SlowCompositeReaderWrapper.wrap(r);
|
||||
AtomicReader slowR = SlowCompositeReaderWrapper.wrap(r);
|
||||
for(String prefix : prefixesArray) {
|
||||
|
||||
final BytesRef prefixRef = prefix == null ? null : new BytesRef(prefix);
|
||||
|
@ -279,7 +279,7 @@ public class TestDocTermOrds extends LuceneTestCase {
|
|||
if (VERBOSE) {
|
||||
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
|
||||
|
@ -296,7 +296,7 @@ public class TestDocTermOrds extends LuceneTestCase {
|
|||
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,
|
||||
"field",
|
||||
|
|
|
@ -696,7 +696,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
|||
w.forceMerge(1);
|
||||
DirectoryReader r = w.getReader();
|
||||
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();
|
||||
d.close();
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
|||
int ord = asSortedSource.getByValue(expected, actual);
|
||||
assertEquals(i, ord);
|
||||
}
|
||||
AtomicIndexReader slowR = SlowCompositeReaderWrapper.wrap(reader);
|
||||
AtomicReader slowR = SlowCompositeReaderWrapper.wrap(reader);
|
||||
Set<Entry<String, String>> entrySet = docToString.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);
|
||||
assertEquals(1, docFreq);
|
||||
DocsEnum termDocsEnum = reader.termDocsEnum(null, term.field, term.bytes, false);
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.document.Document;
|
|||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.document.StringField;
|
||||
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.search.DocIdSetIterator;
|
||||
import org.apache.lucene.store.Directory;
|
||||
|
@ -94,7 +94,7 @@ public class TestDocsAndPositions extends LuceneTestCase {
|
|||
directory.close();
|
||||
}
|
||||
|
||||
public DocsAndPositionsEnum getDocsAndPositions(AtomicIndexReader reader,
|
||||
public DocsAndPositionsEnum getDocsAndPositions(AtomicReader reader,
|
||||
BytesRef bytes, Bits liveDocs) throws IOException {
|
||||
return reader.termPositionsEnum(null, fieldName, bytes, false);
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class TestDocsAndPositions extends LuceneTestCase {
|
|||
doc.add(newField("foo", "bar", StringField.TYPE_UNSTORED));
|
||||
writer.addDocument(doc);
|
||||
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);
|
||||
int docid = disi.docID();
|
||||
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));
|
||||
writer.addDocument(doc);
|
||||
DirectoryReader reader = writer.getReader();
|
||||
AtomicIndexReader r = getOnlySegmentReader(reader);
|
||||
AtomicReader r = getOnlySegmentReader(reader);
|
||||
DocsAndPositionsEnum disi = r.termPositionsEnum(null, "foo", new BytesRef("bar"), false);
|
||||
int docid = disi.docID();
|
||||
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);
|
||||
|
|
|
@ -278,7 +278,7 @@ public class TestFieldsReader extends LuceneTestCase {
|
|||
assertEquals(numDocs, r.numDocs());
|
||||
|
||||
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++) {
|
||||
final Document doc = sub.document(docID);
|
||||
final Field f = (Field) doc.getField("nf");
|
||||
|
|
|
@ -687,7 +687,7 @@ public class TestIndexReader extends LuceneTestCase {
|
|||
|
||||
// Open reader1
|
||||
DirectoryReader r = DirectoryReader.open(dir);
|
||||
AtomicIndexReader r1 = getOnlySegmentReader(r);
|
||||
AtomicReader r1 = getOnlySegmentReader(r);
|
||||
final int[] ints = FieldCache.DEFAULT.getInts(r1, "number", false);
|
||||
assertEquals(1, ints.length);
|
||||
assertEquals(17, ints[0]);
|
||||
|
@ -700,7 +700,7 @@ public class TestIndexReader extends LuceneTestCase {
|
|||
DirectoryReader r2 = DirectoryReader.openIfChanged(r);
|
||||
assertNotNull(r2);
|
||||
r.close();
|
||||
AtomicIndexReader sub0 = (AtomicIndexReader) r2.getSequentialSubReaders()[0];
|
||||
AtomicReader sub0 = (AtomicReader) r2.getSequentialSubReaders()[0];
|
||||
final int[] ints2 = FieldCache.DEFAULT.getInts(sub0, "number", false);
|
||||
r2.close();
|
||||
assertTrue(ints == ints2);
|
||||
|
@ -721,7 +721,7 @@ public class TestIndexReader extends LuceneTestCase {
|
|||
writer.commit();
|
||||
|
||||
DirectoryReader r = DirectoryReader.open(dir);
|
||||
AtomicIndexReader r1 = getOnlySegmentReader(r);
|
||||
AtomicReader r1 = getOnlySegmentReader(r);
|
||||
assertEquals(36, r1.getUniqueTermCount());
|
||||
writer.addDocument(doc);
|
||||
writer.commit();
|
||||
|
@ -731,7 +731,7 @@ public class TestIndexReader extends LuceneTestCase {
|
|||
|
||||
IndexReader[] subs = r2.getSequentialSubReaders();
|
||||
for(int i=0;i<subs.length;i++) {
|
||||
assertEquals(36, ((AtomicIndexReader) subs[i]).getUniqueTermCount());
|
||||
assertEquals(36, ((AtomicReader) subs[i]).getUniqueTermCount());
|
||||
}
|
||||
r2.close();
|
||||
writer.close();
|
||||
|
|
|
@ -540,13 +540,13 @@ public class TestIndexReaderReopen extends LuceneTestCase {
|
|||
static void assertReaderClosed(IndexReader reader, boolean checkSubReaders, boolean checkNormsClosed) {
|
||||
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...
|
||||
// assertTrue(((SegmentReader) reader).normsClosed());
|
||||
}
|
||||
|
||||
if (checkSubReaders && reader instanceof CompositeIndexReader) {
|
||||
IndexReader[] subReaders = ((CompositeIndexReader) reader).getSequentialSubReaders();
|
||||
if (checkSubReaders && reader instanceof CompositeReader) {
|
||||
IndexReader[] subReaders = ((CompositeReader) reader).getSequentialSubReaders();
|
||||
for (int i = 0; i < subReaders.length; i++) {
|
||||
assertReaderClosed(subReaders[i], checkSubReaders, checkNormsClosed);
|
||||
}
|
||||
|
|
|
@ -776,7 +776,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
AtomicIndexReader subreader = getOnlySegmentReader(reader);
|
||||
AtomicReader subreader = getOnlySegmentReader(reader);
|
||||
TermsEnum te = subreader.fields().terms("").iterator(null);
|
||||
assertEquals(new BytesRef("a"), te.next());
|
||||
assertEquals(new BytesRef("b"), te.next());
|
||||
|
@ -797,7 +797,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
AtomicIndexReader subreader = getOnlySegmentReader(reader);
|
||||
AtomicReader subreader = getOnlySegmentReader(reader);
|
||||
TermsEnum te = subreader.fields().terms("").iterator(null);
|
||||
assertEquals(new BytesRef(""), te.next());
|
||||
assertEquals(new BytesRef("a"), te.next());
|
||||
|
@ -1301,7 +1301,7 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
d.add(f);
|
||||
w.addDocument(d);
|
||||
|
||||
AtomicIndexReader r = getOnlySegmentReader(w.getReader());
|
||||
AtomicReader r = getOnlySegmentReader(w.getReader());
|
||||
TermsEnum t = r.fields().terms("field").iterator(null);
|
||||
int count = 0;
|
||||
while(t.next() != null) {
|
||||
|
|
|
@ -602,7 +602,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
|
|||
private static class MyWarmer extends IndexWriter.IndexReaderWarmer {
|
||||
int warmCount;
|
||||
@Override
|
||||
public void warm(AtomicIndexReader reader) throws IOException {
|
||||
public void warm(AtomicReader reader) throws IOException {
|
||||
warmCount++;
|
||||
}
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ public class TestIndexWriterReader extends LuceneTestCase {
|
|||
setReaderPooling(true).
|
||||
setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
|
||||
@Override
|
||||
public void warm(AtomicIndexReader r) throws IOException {
|
||||
public void warm(AtomicReader r) throws IOException {
|
||||
IndexSearcher s = newSearcher(r);
|
||||
TopDocs hits = s.search(new TermQuery(new Term("foo", "bar")), 10);
|
||||
assertEquals(20, hits.totalHits);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue