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 AtomicReaderContext for all sub-readers via Leaves. 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. 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. 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.
Implements
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public abstract class CompositeReader : IndexReader, IDisposable
Constructors
| Improve this Doc View SourceCompositeReader()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
protected CompositeReader()
Properties
| Improve this Doc View SourceContext
Declaration
public sealed override IndexReaderContext Context { get; }
Property Value
Type | Description |
---|---|
IndexReaderContext |
Overrides
Methods
| Improve this Doc View SourceGetSequentialSubReaders()
Expert: returns the sequential sub readers that this
reader is logically composed of. This method may not
return null
.
NOTE: In contrast to previous Lucene versions this method is no longer public, code that wants to get all AtomicReaders this composite is composed of should use Leaves.
Declaration
protected abstract IList<IndexReader> GetSequentialSubReaders()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<IndexReader> |
See Also
| Improve this Doc View SourceToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |