|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.index.IndexReader org.apache.lucene.index.CompositeReader
public abstract class CompositeReader
Instances of this reader type can only
be used to get stored fields from the underlying AtomicReaders,
but it is not possible to directly retrieve postings. To do that, get
the sub-readers via getSequentialSubReaders()
.
Alternatively, you can mimic an AtomicReader
(with a serious slowdown),
by wrapping composite readers with SlowCompositeReaderWrapper
.
IndexReader instances for indexes on disk are usually constructed
with a call to one of the static DirectoryReader.open()
methods,
e.g. DirectoryReader.open(Directory)
. DirectoryReader
implements
the CompositeReader
interface, it is not possible to directly get postings.
Concrete subclasses of IndexReader are usually constructed with a call to
one of the static open()
methods, e.g. DirectoryReader.open(Directory)
.
For efficiency, in this API documents are often referred to via document numbers, non-negative integers which each name a unique document in the index. These document numbers are ephemeral -- they may change as documents are added to and deleted from an index. Clients should thus not rely on a given document having the same number between sessions.
NOTE: IndexReader
instances are completely thread
safe, meaning multiple threads can call any of its methods,
concurrently. If your application requires external
synchronization, you should not synchronize on the
IndexReader
instance; use your own
(non-Lucene) objects instead.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader |
---|
IndexReader.ReaderClosedListener |
Constructor Summary | |
---|---|
protected |
CompositeReader()
|
Method Summary | |
---|---|
abstract List<? extends IndexReader> |
getSequentialSubReaders()
Expert: returns the sequential sub readers that this reader is logically composed of. |
CompositeReaderContext |
getTopReaderContext()
Expert: Returns a the root IndexReaderContext for this
IndexReader 's sub-reader tree. |
String |
toString()
|
Methods inherited from class org.apache.lucene.index.IndexReader |
---|
addReaderClosedListener, close, decRef, docFreq, docFreq, doClose, document, document, document, ensureOpen, equals, getCombinedCoreAndDeletesKey, getCoreCacheKey, getRefCount, getTermVector, getTermVectors, hasDeletions, hashCode, incRef, maxDoc, numDeletedDocs, numDocs, open, open, open, open, open, registerParentReader, removeReaderClosedListener, tryIncRef |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected CompositeReader()
Method Detail |
---|
public String toString()
toString
in class Object
public abstract List<? extends IndexReader> getSequentialSubReaders()
public final CompositeReaderContext getTopReaderContext()
IndexReader
IndexReaderContext
for this
IndexReader
's sub-reader tree. Iff this reader is composed of sub
readers ,ie. this reader being a composite reader, this method returns a
CompositeReaderContext
holding the reader's direct children as well as a
view of the reader tree's atomic leaf contexts. All sub-
IndexReaderContext
instances referenced from this readers top-level
context are private to this reader and are not shared with another context
tree. For example, IndexSearcher uses this API to drive searching by one
atomic leaf reader at a time. If this reader is not composed of child
readers, this method returns an AtomicReaderContext
.
Note: Any of the sub-CompositeReaderContext
instances reference from this
top-level context holds a null
CompositeReaderContext.leaves()
reference. Only the top-level context maintains the convenience leaf-view
for performance reasons.
getTopReaderContext
in class IndexReader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |