Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class MultiFields

    Exposes flex API, merged from flex API of sub-segments. This is useful when you're interacting with an IndexReader implementation that consists of sequential sub-readers (eg DirectoryReader or MultiReader).

    NOTE: for composite readers, you'll get better performance by gathering the sub readers using Context to get the atomic leaves and then operate per-AtomicReader, instead of using this class.

    Note

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

    Inheritance
    object
    Fields
    MultiFields
    Implements
    IEnumerable<string>
    IEnumerable
    Inherited Members
    Fields.UniqueTermCount
    Fields.EMPTY_ARRAY
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public sealed class MultiFields : Fields, IEnumerable<string>, IEnumerable

    Constructors

    MultiFields(Fields[], ReaderSlice[])

    Expert: construct a new MultiFields instance directly.

    Note

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

    Declaration
    public MultiFields(Fields[] subs, ReaderSlice[] subSlices)
    Parameters
    Type Name Description
    Fields[] subs
    ReaderSlice[] subSlices

    Properties

    Count

    Gets the number of fields or -1 if the number of distinct field names is unknown. If >= 0, GetEnumerator() will return as many field names.

    NOTE: This was size() in Lucene.
    Declaration
    public override int Count { get; }
    Property Value
    Type Description
    int
    Overrides
    Fields.Count

    Methods

    GetEnumerator()

    Returns an enumerator that will step through all field names. This will not return null.

    Declaration
    public override IEnumerator<string> GetEnumerator()
    Returns
    Type Description
    IEnumerator<string>
    Overrides
    Fields.GetEnumerator()

    GetFields(IndexReader)

    Returns a single Fields instance for this reader, merging fields/terms/docs/positions on the fly. This method will return null if the reader has no postings.

    NOTE: this is a slow way to access postings. It's better to get the sub-readers and iterate through them yourself.
    Declaration
    public static Fields GetFields(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    Fields

    GetIndexedFields(IndexReader)

    Call this to get the (merged) FieldInfos representing the set of indexed fields only for a composite reader.

    NOTE: the returned field numbers will likely not correspond to the actual field numbers in the underlying readers, and codec metadata (GetAttribute(string)) will be unavailable.
    Declaration
    public static ICollection<string> GetIndexedFields(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    ICollection<string>

    GetLiveDocs(IndexReader)

    Returns a single IBits instance for this reader, merging live Documents on the fly. This method will return null if the reader has no deletions.

    NOTE: this is a very slow way to access live docs. For example, each IBits access will require a binary search. It's better to get the sub-readers and iterate through them yourself.
    Declaration
    public static IBits GetLiveDocs(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    IBits

    GetMergedFieldInfos(IndexReader)

    Call this to get the (merged) FieldInfos for a composite reader.

    NOTE: the returned field numbers will likely not correspond to the actual field numbers in the underlying readers, and codec metadata (GetAttribute(string)) will be unavailable.
    Declaration
    public static FieldInfos GetMergedFieldInfos(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    FieldInfos

    GetTermDocsEnum(IndexReader, IBits, string, BytesRef)

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

    Declaration
    public static DocsEnum GetTermDocsEnum(IndexReader r, IBits liveDocs, string field, BytesRef term)
    Parameters
    Type Name Description
    IndexReader r
    IBits liveDocs
    string field
    BytesRef term
    Returns
    Type Description
    DocsEnum

    GetTermDocsEnum(IndexReader, IBits, string, BytesRef, DocsFlags)

    Returns DocsEnum for the specified field & term, with control over whether freqs are required. Some codecs may be able to optimize their implementation when freqs are not required. This will return null if the field or term does not exist. See Docs(IBits, DocsEnum, DocsFlags).

    Declaration
    public static DocsEnum GetTermDocsEnum(IndexReader r, IBits liveDocs, string field, BytesRef term, DocsFlags flags)
    Parameters
    Type Name Description
    IndexReader r
    IBits liveDocs
    string field
    BytesRef term
    DocsFlags flags
    Returns
    Type Description
    DocsEnum

    GetTermPositionsEnum(IndexReader, IBits, string, BytesRef)

    Returns DocsAndPositionsEnum for the specified field & term. This will return null if the field or term does not exist or positions were not indexed.

    Declaration
    public static DocsAndPositionsEnum GetTermPositionsEnum(IndexReader r, IBits liveDocs, string field, BytesRef term)
    Parameters
    Type Name Description
    IndexReader r
    IBits liveDocs
    string field
    BytesRef term
    Returns
    Type Description
    DocsAndPositionsEnum
    See Also
    GetTermPositionsEnum(IndexReader, IBits, string, BytesRef, DocsAndPositionsFlags)

    GetTermPositionsEnum(IndexReader, IBits, string, BytesRef, DocsAndPositionsFlags)

    Returns DocsAndPositionsEnum for the specified field & term, with control over whether offsets and payloads are required. Some codecs may be able to optimize their implementation when offsets and/or payloads are not required. This will return null if the field or term does not exist or positions were not indexed. See DocsAndPositions(IBits, DocsAndPositionsEnum, DocsAndPositionsFlags).

    Declaration
    public static DocsAndPositionsEnum GetTermPositionsEnum(IndexReader r, IBits liveDocs, string field, BytesRef term, DocsAndPositionsFlags flags)
    Parameters
    Type Name Description
    IndexReader r
    IBits liveDocs
    string field
    BytesRef term
    DocsAndPositionsFlags flags
    Returns
    Type Description
    DocsAndPositionsEnum

    GetTerms(IndexReader, string)

    this method may return null if the field does not exist.

    Declaration
    public static Terms GetTerms(IndexReader r, string field)
    Parameters
    Type Name Description
    IndexReader r
    string field
    Returns
    Type Description
    Terms

    GetTerms(string)

    Get the Terms for this field. This will return null if the field does not exist.

    Declaration
    public override Terms GetTerms(string field)
    Parameters
    Type Name Description
    string field
    Returns
    Type Description
    Terms
    Overrides
    Fields.GetTerms(string)

    Implements

    IEnumerable<T>
    IEnumerable
    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.