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
BaseCompositeReader<R>
Assembly: Lucene.Net.dll
Syntax
public abstract class BaseCompositeReader<R> : CompositeReader, IDisposable where R : IndexReader
Type Parameters
Constructors
BaseCompositeReader(R[])
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
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
Overrides
See Also
NumDocs
Returns the number of documents in this index.
Declaration
public override sealed int NumDocs { get; }
Property Value
Overrides
See Also
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
Overrides
See Also
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
Overrides
See Also
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
Overrides
See Also
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
Overrides
See Also
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
Overrides
See Also
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
Overrides
See Also
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
Overrides
See Also
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
See Also
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
See Also
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
Overrides
See Also
Implements
See Also