CLucene - a full-featured, c++ search engine
API Documentation
#include <MultiReader.h>
Public Member Functions | |
MultiReader (lucene::store::Directory *directory, SegmentInfos *sis, IndexReader **subReaders) | |
Construct reading the named set of readers. | |
MultiReader (IndexReader **subReaders) | |
~MultiReader () | |
bool | getTermFreqVectors (int32_t n, lucene::util::Array< TermFreqVector * > &result) |
Return an array of term frequency vectors for the specified document. | |
TermFreqVector * | getTermFreqVector (int32_t n, const TCHAR *field) |
Return a term frequency vector for the specified document and field. | |
int32_t | numDocs () |
Returns the number of documents in this index. | |
int32_t | maxDoc () const |
Returns one greater than the largest possible document number. | |
bool | document (int32_t n, lucene::document::Document *doc) |
Gets the stored fields of the n th Document in this index. | |
bool | isDeleted (const int32_t n) |
Returns true if document n has been deleted. | |
bool | hasDeletions () const |
Returns true if any documents have been deleted. | |
uint8_t * | norms (const TCHAR *field) |
Returns the byte-encoded normalization factor for the named field of every document. | |
void | norms (const TCHAR *field, uint8_t *result) |
Reads the byte-encoded normalization factor for the named field of every document. | |
TermEnum * | terms () const |
Returns an enumeration of all the terms in the index. | |
TermEnum * | terms (const Term *term) const |
Returns an enumeration of all terms after a given term. | |
int32_t | docFreq (const Term *t=NULL) const |
Returns the number of documents containing the term t . | |
TermDocs * | termDocs () const |
Returns an unpositioned TermDocs enumerator. | |
TermPositions * | termPositions () const |
void | getFieldNames (FieldOption fldOption, StringArrayWithDeletor &retarray) |
Protected Member Functions | |
void | doSetNorm (int32_t n, const TCHAR *field, uint8_t value) |
Implements setNorm in subclass. | |
void | doUndeleteAll () |
Implements actual undeleteAll() in subclass. | |
void | doCommit () |
Internal use. | |
void | doClose () |
Implements close. | |
void | doDelete (const int32_t n) |
Implements deletion of the document numbered docNum . |
lucene::index::MultiReader::MultiReader | ( | lucene::store::Directory * | directory, | |
SegmentInfos * | sis, | |||
IndexReader ** | subReaders | |||
) |
Construct reading the named set of readers.
lucene::index::MultiReader::MultiReader | ( | IndexReader ** | subReaders | ) |
Construct a MultiReader aggregating the named set of (sub)readers. Directory locking for delete, undeleteAll, and setNorm operations is left to the subreaders.
Note that all subreaders are closed if this Multireader is closed.
subReaders | set of (sub)readers |
IOException |
lucene::index::MultiReader::~MultiReader | ( | ) |
void lucene::index::MultiReader::doSetNorm | ( | int32_t | doc, | |
const TCHAR * | field, | |||
uint8_t | value | |||
) | [protected, virtual] |
void lucene::index::MultiReader::doUndeleteAll | ( | ) | [protected, virtual] |
void lucene::index::MultiReader::doCommit | ( | ) | [protected, virtual] |
void lucene::index::MultiReader::doClose | ( | ) | [protected, virtual] |
void lucene::index::MultiReader::doDelete | ( | const int32_t | docNum | ) | [protected, virtual] |
Implements deletion of the document numbered docNum
.
Applications should call deleteDocument(int32_t) or deleteDocuments(Term*).
Implements lucene::index::IndexReader.
bool lucene::index::MultiReader::getTermFreqVectors | ( | int32_t | n, | |
lucene::util::Array< TermFreqVector * > & | result | |||
) | [virtual] |
Return an array of term frequency vectors for the specified document.
The array contains a vector for each vectorized field in the document. Each vector vector contains term numbers and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null.
Implements lucene::index::IndexReader.
TermFreqVector* lucene::index::MultiReader::getTermFreqVector | ( | int32_t | docNumber, | |
const TCHAR * | field | |||
) | [virtual] |
Return a term frequency vector for the specified document and field.
The returned vector contains terms and frequencies for the terms in the specified field of this document, if the field had the storeTermVector flag set. If termvectors had been stored with positions or offsets, a TermPositionsVector is returned.
docNumber | document for which the term frequency vector is returned | |
field | field for which the term frequency vector is returned. |
IOException | if index cannot be accessed |
Implements lucene::index::IndexReader.
int32_t lucene::index::MultiReader::numDocs | ( | ) | [virtual] |
int32_t lucene::index::MultiReader::maxDoc | ( | ) | const [virtual] |
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.
Implements lucene::index::IndexReader.
bool lucene::index::MultiReader::document | ( | int32_t | n, | |
lucene::document::Document * | ||||
) | [virtual] |
Gets the stored fields of the n
th Document
in this index.
The fields are not cleared before retrieving the document, so the object should be new or just cleared.
Implements lucene::index::IndexReader.
bool lucene::index::MultiReader::isDeleted | ( | const int32_t | n | ) | [virtual] |
bool lucene::index::MultiReader::hasDeletions | ( | ) | const [virtual] |
uint8_t* lucene::index::MultiReader::norms | ( | const TCHAR * | field | ) | [virtual] |
Returns the byte-encoded normalization factor for the named field of every document.
This is used by the search code to score documents.
The number of bytes returned is the size of the IndexReader->maxDoc() MEMORY: The values are cached, so don't delete the returned byte array.
Implements lucene::index::IndexReader.
void lucene::index::MultiReader::norms | ( | const TCHAR * | field, | |
uint8_t * | bytes | |||
) | [virtual] |
Reads the byte-encoded normalization factor for the named field of every document.
This is used by the search code to score documents.
Implements lucene::index::IndexReader.
TermEnum* lucene::index::MultiReader::terms | ( | ) | const [virtual] |
Returns an enumeration of all the terms in the index.
The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration.
Implements lucene::index::IndexReader.
Returns an enumeration of all terms after a given term.
The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration.
Implements lucene::index::IndexReader.
int32_t lucene::index::MultiReader::docFreq | ( | const Term * | t = NULL |
) | const [virtual] |
TermDocs* lucene::index::MultiReader::termDocs | ( | ) | const [virtual] |
Returns an unpositioned TermDocs enumerator.
Implements lucene::index::IndexReader.
TermPositions* lucene::index::MultiReader::termPositions | ( | ) | const [virtual] |
Implements lucene::index::IndexReader.
void lucene::index::MultiReader::getFieldNames | ( | FieldOption | fldOption, | |
StringArrayWithDeletor & | retarray | |||
) | [virtual] |
Implements lucene::index::IndexReader.