Class SegmentReader
IndexReader implementation over a single segment.
Instances pointing to the same segment (but with different deletes, etc) may share the same core data.Note
This API is experimental and might change in incompatible ways in the next release.
Implements
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public sealed class SegmentReader : AtomicReader, IDisposable
Constructors
SegmentReader(SegmentCommitInfo, int, IOContext)
Constructs a new SegmentReader with a new core.
Declaration
public SegmentReader(SegmentCommitInfo si, int termInfosIndexDivisor, IOContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| SegmentCommitInfo | si | |
| int | termInfosIndexDivisor | |
| IOContext | context |
Exceptions
| Type | Condition |
|---|---|
| CorruptIndexException | if the index is corrupt |
| IOException | if there is a low-level IO error |
Properties
CombinedCoreAndDeletesKey
Expert: Returns a key for this IndexReader that also includes deletions, so IFieldCache/CachingWrapperFilter can find it again. This key must not have Equals()/GetHashCode() methods, so "equals" means "identical".
Declaration
public override object CombinedCoreAndDeletesKey { get; }
Property Value
| Type | Description |
|---|---|
| object |
Overrides
CoreCacheKey
Expert: Returns a key for this IndexReader, so FieldCache/CachingWrapperFilter can find it again. This key must not have Equals()/GetHashCode() methods, so "equals" means "identical".
Declaration
public override object CoreCacheKey { get; }
Property Value
| Type | Description |
|---|---|
| object |
Overrides
Directory
Returns the directory this index resides in.
Declaration
public Directory Directory { get; }
Property Value
| Type | Description |
|---|---|
| Directory |
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 override FieldInfos FieldInfos { get; }
Property Value
| Type | Description |
|---|---|
| FieldInfos |
Overrides
Fields
Returns Fields for this reader.
this property may return null if the reader has no
postings.
Declaration
public override Fields Fields { get; }
Property Value
| Type | Description |
|---|---|
| Fields |
Overrides
FieldsReader
Expert: retrieve thread-private StoredFieldsReader
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public StoredFieldsReader FieldsReader { get; }
Property Value
| Type | Description |
|---|---|
| StoredFieldsReader |
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).
Declaration
public override IBits LiveDocs { get; }
Property Value
| Type | Description |
|---|---|
| IBits |
Overrides
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 int MaxDoc { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
NumDocs
Returns the number of documents in this index.
Declaration
public override int NumDocs { get; }
Property Value
| Type | Description |
|---|---|
| int |
Overrides
SegmentInfo
Return the SegmentCommitInfo of the segment this reader is reading.
Declaration
public SegmentCommitInfo SegmentInfo { get; }
Property Value
| Type | Description |
|---|---|
| SegmentCommitInfo |
SegmentName
Return the name of the segment this reader is reading.
Declaration
public string SegmentName { get; }
Property Value
| Type | Description |
|---|---|
| string |
TermInfosIndexDivisor
Returns term infos index divisor originally passed to SegmentReader(SegmentCommitInfo, int, IOContext).
Declaration
public int TermInfosIndexDivisor { get; }
Property Value
| Type | Description |
|---|---|
| int |
TermVectorsReader
Expert: retrieve thread-private TermVectorsReader
Note
This API is for internal purposes only and might change in incompatible ways in the next release.
Declaration
public TermVectorsReader TermVectorsReader { get; }
Property Value
| Type | Description |
|---|---|
| TermVectorsReader |
Methods
AddCoreDisposedListener(ICoreDisposedListener)
Expert: adds a SegmentReader.ICoreDisposedListener to this reader's shared core
Declaration
public void AddCoreDisposedListener(SegmentReader.ICoreDisposedListener listener)
Parameters
| Type | Name | Description |
|---|---|---|
| SegmentReader.ICoreDisposedListener | listener |
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 override void CheckIntegrity()
Overrides
DoClose()
Implements close.
Declaration
protected override void DoClose()
Overrides
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 void Document(int docID, StoredFieldVisitor visitor)
Parameters
| Type | Name | Description |
|---|---|---|
| int | docID | |
| StoredFieldVisitor | visitor |
Overrides
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 override BinaryDocValues GetBinaryDocValues(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| BinaryDocValues |
Overrides
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 override IBits GetDocsWithField(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| IBits |
Overrides
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 override NumericDocValues GetNormValues(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| NumericDocValues |
Overrides
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 override NumericDocValues GetNumericDocValues(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| NumericDocValues |
Overrides
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 override SortedDocValues GetSortedDocValues(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| SortedDocValues |
Overrides
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 override SortedSetDocValues GetSortedSetDocValues(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| SortedSetDocValues |
Overrides
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 Fields GetTermVectors(int docID)
Parameters
| Type | Name | Description |
|---|---|---|
| int | docID |
Returns
| Type | Description |
|---|---|
| Fields |
Overrides
RamBytesUsed()
Returns approximate RAM Bytes used
Declaration
public long RamBytesUsed()
Returns
| Type | Description |
|---|---|
| long |
RemoveCoreDisposedListener(ICoreDisposedListener)
Expert: removes a SegmentReader.ICoreDisposedListener from this reader's shared core
Declaration
public void RemoveCoreDisposedListener(SegmentReader.ICoreDisposedListener listener)
Parameters
| Type | Name | Description |
|---|---|---|
| SegmentReader.ICoreDisposedListener | listener |
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. |