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.
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
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
Overrides
Methods
GetEnumerator()
Returns an enumerator that will step through all field
names. This will not return null
.
Declaration
public override IEnumerator<string> GetEnumerator()
Returns
Overrides
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
See Also
GetTermPositionsEnum(IndexReader, IBits, string, BytesRef, DocsAndPositionsFlags)
Declaration
public static DocsAndPositionsEnum GetTermPositionsEnum(IndexReader r, IBits liveDocs, string field, BytesRef term, DocsAndPositionsFlags flags)
Parameters
Returns
GetTerms(IndexReader, string)
this method may return null
if the field does not exist.
Declaration
public static Terms GetTerms(IndexReader r, string field)
Parameters
Returns
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
Overrides
Implements