Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class BaseCompositeReader<R>

    Base class for implementing CompositeReaders based on an array of sub-readers. The implementing class has to add code for correctly refcounting and closing the sub-readers.

    User code will most likely use MultiReader to build a composite reader on a set of sub-readers (like several DirectoryReaders).

    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.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Inheritance
    object
    IndexReader
    CompositeReader
    BaseCompositeReader<R>
    DirectoryReader
    MultiReader
    ParallelCompositeReader
    Implements
    IDisposable
    Inherited Members
    CompositeReader.ToString()
    CompositeReader.Context
    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.GetTermVector(int, string)
    IndexReader.NumDeletedDocs
    IndexReader.Document(int)
    IndexReader.Document(int, ISet<string>)
    IndexReader.HasDeletions
    IndexReader.Dispose()
    IndexReader.Dispose(bool)
    IndexReader.DoClose()
    IndexReader.Leaves
    IndexReader.CoreCacheKey
    IndexReader.CombinedCoreAndDeletesKey
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class BaseCompositeReader<R> : CompositeReader, IDisposable where R : IndexReader
    Type Parameters
    Name Description
    R

    Constructors

    BaseCompositeReader(R[])

    Constructs a BaseCompositeReader<R> on the given subReaders.

    Declaration
    protected BaseCompositeReader(R[] subReaders)
    Parameters
    Type Name Description
    R[] subReaders

    the wrapped sub-readers. This array is returned by GetSequentialSubReaders() and used to resolve the correct subreader for docID-based methods. Please note: this array is not cloned and not protected for modification, the subclass is responsible to do this.

    See Also
    MultiReader

    Properties

    MaxDoc

    Returns one greater than the largest possible document number. this may be used to, e.g., determine how big to allocate an array which will have an element for every document number in an index.

    Declaration
    public override sealed int MaxDoc { get; }
    Property Value
    Type Description
    int
    Overrides
    IndexReader.MaxDoc
    See Also
    MultiReader

    NumDocs

    Returns the number of documents in this index.

    Declaration
    public override sealed int NumDocs { get; }
    Property Value
    Type Description
    int
    Overrides
    IndexReader.NumDocs
    See Also
    MultiReader

    Methods

    DocFreq(Term)

    Returns the number of documents containing the term. This method returns 0 if the term or field does not exist. This method does not take into account deleted documents that have not yet been merged away.

    Declaration
    public override sealed int DocFreq(Term term)
    Parameters
    Type Name Description
    Term term
    Returns
    Type Description
    int
    Overrides
    IndexReader.DocFreq(Term)
    See Also
    DocFreq

    Document(int, StoredFieldVisitor)

    Expert: visits the fields of a stored document, for custom processing/loading of each field. If you simply want to load all fields, use Document(int). If you want to load a subset, use DocumentStoredFieldVisitor.

    Declaration
    public override sealed void Document(int docID, StoredFieldVisitor visitor)
    Parameters
    Type Name Description
    int docID
    StoredFieldVisitor visitor
    Overrides
    IndexReader.Document(int, StoredFieldVisitor)
    See Also
    MultiReader

    GetDocCount(string)

    Returns the number of documents that have at least one term for this field, or -1 if this measure isn't stored by the codec. Note that, just like other term measures, this measure does not take deleted documents into account.

    Declaration
    public override sealed int GetDocCount(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    int
    Overrides
    IndexReader.GetDocCount(string)
    See Also
    DocCount

    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 override sealed IList<IndexReader> GetSequentialSubReaders()
    Returns
    Type Description
    IList<IndexReader>
    Overrides
    CompositeReader.GetSequentialSubReaders()
    See Also
    Leaves

    GetSumDocFreq(string)

    Returns the sum of DocFreq for all terms in this field, or -1 if this measure isn't stored by the codec. Note that, just like other term measures, this measure does not take deleted documents into account.

    Declaration
    public override sealed long GetSumDocFreq(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    long
    Overrides
    IndexReader.GetSumDocFreq(string)
    See Also
    SumDocFreq

    GetSumTotalTermFreq(string)

    Returns the sum of TotalTermFreq for all terms in this field, or -1 if this measure isn't stored by the codec (or if this fields omits term freq and positions). Note that, just like other term measures, this measure does not take deleted documents into account.

    Declaration
    public override sealed long GetSumTotalTermFreq(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    long
    Overrides
    IndexReader.GetSumTotalTermFreq(string)
    See Also
    SumTotalTermFreq

    GetTermVectors(int)

    Retrieve term vectors for this document, or null if term vectors were not indexed. The returned Fields instance acts like a single-document inverted index (the docID will be 0).

    Declaration
    public override sealed Fields GetTermVectors(int docID)
    Parameters
    Type Name Description
    int docID
    Returns
    Type Description
    Fields
    Overrides
    IndexReader.GetTermVectors(int)
    See Also
    MultiReader

    ReaderBase(int)

    Helper method for subclasses to get the docBase of the given sub-reader index.

    Declaration
    protected int ReaderBase(int readerIndex)
    Parameters
    Type Name Description
    int readerIndex
    Returns
    Type Description
    int
    See Also
    MultiReader

    ReaderIndex(int)

    Helper method for subclasses to get the corresponding reader for a doc ID

    Declaration
    protected int ReaderIndex(int docID)
    Parameters
    Type Name Description
    int docID
    Returns
    Type Description
    int
    See Also
    MultiReader

    TotalTermFreq(Term)

    Returns the total number of occurrences of term across all documents (the sum of the Freq for each doc that has this term). This will be -1 if the codec doesn't support this measure. Note that, like other term measures, this measure does not take deleted documents into account.

    Declaration
    public override sealed long TotalTermFreq(Term term)
    Parameters
    Type Name Description
    Term term
    Returns
    Type Description
    long
    Overrides
    IndexReader.TotalTermFreq(Term)
    See Also
    MultiReader

    Implements

    IDisposable

    See Also

    MultiReader
    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.