Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class AtomicReader

    AtomicReader is an abstract class, providing an interface for accessing an index. Search of an index is done entirely through this abstract interface, so that any subclass which implements it is searchable. IndexReaders implemented by this subclass do not consist of several sub-readers, they are atomic. They support retrieval of stored fields, doc values, terms, and postings.

    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
    AtomicReader
    FilterAtomicReader
    ParallelAtomicReader
    SegmentReader
    SlowCompositeReaderWrapper
    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
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class AtomicReader : IndexReader, IDisposable

    Constructors

    AtomicReader()

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

    Declaration
    protected AtomicReader()

    Properties

    AtomicContext

    LUCENENET specific propety that allows access to the context as AtomicReaderContext, which prevents the need to cast.

    Declaration
    public AtomicReaderContext AtomicContext { get; }
    Property Value
    Type Description
    AtomicReaderContext

    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

    FieldInfos

    Get the FieldInfos describing all fields in this reader.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public abstract FieldInfos FieldInfos { get; }
    Property Value
    Type Description
    FieldInfos

    Fields

    Returns Fields for this reader. this property may return null if the reader has no postings.

    Declaration
    public abstract Fields Fields { get; }
    Property Value
    Type Description
    Fields

    LiveDocs

    Returns the IBits representing live (not deleted) docs. A set bit indicates the doc ID has not been deleted. If this method returns null it means there are no deleted documents (all documents are live).

    The returned instance has been safely published for use by multiple threads without additional synchronization.
    Declaration
    public abstract IBits LiveDocs { get; }
    Property Value
    Type Description
    IBits

    Methods

    CheckIntegrity()

    Checks consistency of this reader.

    Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.

    Note

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

    Declaration
    public abstract void CheckIntegrity()

    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

    GetBinaryDocValues(string)

    Returns BinaryDocValues for this field, or null if no BinaryDocValues were indexed for this field. The returned instance should only be used by a single thread.

    Declaration
    public abstract BinaryDocValues GetBinaryDocValues(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    BinaryDocValues

    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

    GetDocsWithField(string)

    Returns a IBits at the size of reader.MaxDoc, with turned on bits for each docid that does have a value for this field, or null if no DocValues were indexed for this field. The returned instance should only be used by a single thread.

    Declaration
    public abstract IBits GetDocsWithField(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    IBits

    GetNormValues(string)

    Returns NumericDocValues representing norms for this field, or null if no NumericDocValues were indexed. The returned instance should only be used by a single thread.

    Declaration
    public abstract NumericDocValues GetNormValues(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    NumericDocValues

    GetNumericDocValues(string)

    Returns NumericDocValues for this field, or null if no NumericDocValues were indexed for this field. The returned instance should only be used by a single thread.

    Declaration
    public abstract NumericDocValues GetNumericDocValues(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    NumericDocValues

    GetSortedDocValues(string)

    Returns SortedDocValues for this field, or null if no SortedDocValues were indexed for this field. The returned instance should only be used by a single thread.

    Declaration
    public abstract SortedDocValues GetSortedDocValues(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    SortedDocValues

    GetSortedSetDocValues(string)

    Returns SortedSetDocValues for this field, or null if no SortedSetDocValues were indexed for this field. The returned instance should only be used by a single thread.

    Declaration
    public abstract SortedSetDocValues GetSortedSetDocValues(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    SortedSetDocValues

    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

    GetTermDocsEnum(Term)

    Returns DocsEnum for the specified term. This will return null if either the field or term does not exist.

    Declaration
    public DocsEnum GetTermDocsEnum(Term term)
    Parameters
    Type Name Description
    Term term
    Returns
    Type Description
    DocsEnum
    See Also
    Docs(IBits, DocsEnum)

    GetTermPositionsEnum(Term)

    Returns DocsAndPositionsEnum for the specified term. This will return null if the field or term does not exist or positions weren't indexed.

    Declaration
    public DocsAndPositionsEnum GetTermPositionsEnum(Term term)
    Parameters
    Type Name Description
    Term term
    Returns
    Type Description
    DocsAndPositionsEnum
    See Also
    DocsAndPositions(IBits, DocsAndPositionsEnum)

    GetTerms(string)

    This may return null if the field does not exist.

    Declaration
    public Terms GetTerms(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    Terms

    HasNorms(string)

    Returns true if there are norms stored for this field.

    Declaration
    [Obsolete("(4.0) use FieldInfos and check FieldInfo.HasNorms for the field instead.")]
    public bool HasNorms(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    bool

    TotalTermFreq(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 long TotalTermFreq(Term term)
    Parameters
    Type Name Description
    Term term
    Returns
    Type Description
    long
    Overrides
    IndexReader.TotalTermFreq(Term)

    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.