Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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.
    Inheritance
    object
    IndexReader
    CompositeReader
    BaseCompositeReader<R>
    Implements
    IDisposable
    Inherited Members
    IndexReader.AddReaderDisposedListener(IReaderDisposedListener)
    IndexReader.RemoveReaderDisposedListener(IReaderDisposedListener)
    IndexReader.RegisterParentReader(IndexReader)
    IndexReader.RefCount
    IndexReader.IncRef()
    IndexReader.TryIncRef()
    IndexReader.DecRef()
    IndexReader.EnsureOpen()
    IndexReader.Equals(object)
    IndexReader.GetHashCode()
    IndexReader.Open(Directory)
    IndexReader.Open(Directory, int)
    IndexReader.Open(IndexWriter, bool)
    IndexReader.Open(IndexCommit)
    IndexReader.Open(IndexCommit, int)
    IndexReader.GetTermVectors(int)
    IndexReader.GetTermVector(int, string)
    IndexReader.NumDocs
    IndexReader.MaxDoc
    IndexReader.NumDeletedDocs
    IndexReader.Document(int, StoredFieldVisitor)
    IndexReader.Document(int)
    IndexReader.Document(int, ISet<string>)
    IndexReader.HasDeletions
    IndexReader.Dispose()
    IndexReader.Dispose(bool)
    IndexReader.DoClose()
    IndexReader.Leaves
    IndexReader.CoreCacheKey
    IndexReader.CombinedCoreAndDeletesKey
    IndexReader.DocFreq(Term)
    IndexReader.TotalTermFreq(Term)
    IndexReader.GetSumDocFreq(string)
    IndexReader.GetDocCount(string)
    IndexReader.GetSumTotalTermFreq(string)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class CompositeReader : IndexReader, IDisposable

    Constructors

    CompositeReader()

    Sole constructor. (For invocation by subclass constructors, typically implicit.)

    Declaration
    protected CompositeReader()

    Properties

    Context

    Expert: Returns the root IndexReaderContext for this IndexReader's sub-reader tree.

    Iff this reader is composed of sub readers, i.e. 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 referenced from this top-level context do not support Leaves. Only the top-level context maintains the convenience leaf-view for performance reasons.
    Declaration
    public override sealed IndexReaderContext Context { get; }
    Property Value
    Type Description
    IndexReaderContext
    Overrides
    IndexReader.Context

    Methods

    GetSequentialSubReaders()

    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
    IList<IndexReader>
    See Also
    Leaves

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()

    Implements

    IDisposable
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.