Lucene++ - a full-featured, c++ search engine
API Documentation
Go to the documentation of this file.
7 #ifndef DIRECTORYREADER_H
8 #define DIRECTORYREADER_H
111 virtual bool hasNorms(
const String& field);
114 virtual ByteArray
norms(
const String& field);
117 virtual void norms(
const String& field, ByteArray
norms, int32_t offset);
174 virtual void doDelete(int32_t docNum);
182 virtual void doSetNorm(int32_t doc,
const String& field, uint8_t value);
187 virtual void doCommit(MapStringString commitUserData);
222 virtual void close();
249 virtual int32_t
doc();
252 virtual int32_t
freq();
268 virtual bool skipTo(int32_t target);
271 virtual void close();
293 virtual ByteArray
getPayload(ByteArray data, int32_t offset);
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document.
virtual int32_t freq()
Returns the frequency of the term within the current document.
virtual void close()
Frees associated resources.
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
bool rollbackHasChanges
Definition: DirectoryReader.h:48
bool stale
Definition: DirectoryReader.h:45
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)
Return a term frequency vector for the specified document and field.
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
virtual int32_t getTermInfosIndexDivisor()
For IndexReader implementations that use TermInfosReader to read terms, this returns the current inde...
virtual ~MultiTermPositions()
Collection< TermDocsPtr > readerTermDocs
Definition: DirectoryReader.h:241
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
IndexReaderPtr doReopenFromWriter(bool openReadOnly, const IndexCommitPtr &commit)
static int32_t readerIndex(int32_t n, Collection< int32_t > starts, int32_t numSubReaders)
Find reader for doc n.
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
virtual String getSegmentsFileName()
Two IndexCommits are equal if both their Directory and versions are equal.
virtual bool skipTo(int32_t target)
Skips entries to the first beyond the current whose document number is greater than or equal to targe...
virtual bool isOptimized()
Checks is the index is optimized (if it has a single segment and no deletions). Not implemented in th...
virtual int32_t getPayloadLength()
Returns the length of the payload at the current term position.
int32_t pointer
Definition: DirectoryReader.h:239
IndexReaderPtr doReopen(bool openReadOnly, const IndexCommitPtr &commit)
virtual void doClose()
Implements close.
IndexReaderWeakPtr _topReader
Definition: DirectoryReader.h:230
int64_t generation
Definition: DirectoryReader.h:313
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition: LuceneTypes.h:254
IndexReaderPtr doReopenNoWriter(bool openReadOnly, const IndexCommitPtr &commit)
static IndexReaderPtr open(const DirectoryPtr &directory, const IndexDeletionPolicyPtr &deletionPolicy, const IndexCommitPtr &commit, bool readOnly, int32_t termInfosIndexDivisor)
virtual bool hasDeletions()
Returns true if any documents have been deleted.
virtual int32_t numDocs()
Returns the number of documents in this index.
DirectoryPtr dir
Definition: DirectoryReader.h:312
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
Definition: DirectoryReader.h:278
HashSet< String > files
Definition: DirectoryReader.h:311
TermPtr term
Definition: DirectoryReader.h:236
MultiTermDocs(const IndexReaderPtr &topReader, Collection< IndexReaderPtr > r, Collection< int32_t > s)
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum.
boost::shared_ptr< Lock > LockPtr
Definition: LuceneTypes.h:496
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index.
virtual MapStringString getUserData()
Returns userData, previously passed to IndexWriter#commit(Map) for this commit.
IndexDeletionPolicyPtr deletionPolicy
Definition: DirectoryReader.h:40
SegmentMergeInfoPtr smi
Definition: DirectoryReader.h:245
virtual int64_t getVersion()
Version number when this IndexReader was opened.
virtual void acquireWriteLock()
Tries to acquire the WriteLock on this directory. this method is only valid if this IndexReader is di...
virtual void doCommit(MapStringString commitUserData)
Commit changes resulting from delete, undeleteAll, or setNorm operations.
virtual Collection< IndexReaderPtr > getSequentialSubReaders()
Returns the sequential sub readers that this reader is logically composed of.
SegmentInfosPtr segmentInfosStart
Definition: DirectoryReader.h:44
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Efficiently clones the IndexReader (sharing most internal state).
int32_t _maxDoc
Definition: DirectoryReader.h:53
virtual int64_t getGeneration()
Returns the generation (the _N in segments_N) for this IndexCommit.
virtual int32_t read(Collection< int32_t > docs, Collection< int32_t > freqs)
Attempts to read multiple entries from the enumeration, up to length of docs. Optimized implementatio...
virtual HashSet< String > getFileNames()
Returns all index files referenced by this commit point.
virtual int32_t maxDoc()
Returns one greater than the largest possible document number.
virtual DocumentPtr document(int32_t n, const FieldSelectorPtr &fieldSelector)
Get the Document at the n'th position. The FieldSelector may be used to determine what Fields to load...
Definition: DirectoryReader.h:225
virtual DirectoryPtr getDirectory()
Returns the Directory for the index.
void _initialize(Collection< SegmentReaderPtr > subReaders)
ReaderCommit(const SegmentInfosPtr &infos, const DirectoryPtr &dir)
virtual ByteArray getPayload(ByteArray data, int32_t offset)
Returns the payload data at the current term position.
Collection< IndexReaderPtr > readers
Definition: DirectoryReader.h:234
Collection< SegmentReaderPtr > subReaders
Definition: DirectoryReader.h:50
int64_t maxIndexVersion
Definition: DirectoryReader.h:59
boost::weak_ptr< IndexWriter > IndexWriterWeakPtr
Definition: LuceneTypes.h:160
boost::shared_ptr< DirectoryReader > DirectoryReaderPtr
Definition: LuceneTypes.h:105
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74
boost::weak_ptr< IndexReader > IndexReaderWeakPtr
Definition: LuceneTypes.h:157
Definition: AbstractAllTermDocs.h:12
bool _isOptimized
Definition: DirectoryReader.h:315
boost::shared_ptr< SegmentMergeQueue > SegmentMergeQueuePtr
Definition: LuceneTypes.h:213
An IndexReader which reads indexes with multiple segments.
Definition: DirectoryReader.h:19
Base class for all Lucene classes.
Definition: LuceneObject.h:31
virtual DirectoryPtr directory()
Returns the directory this index resides in.
TermDocsPtr current
Definition: DirectoryReader.h:242
DirectoryPtr _directory
Definition: DirectoryReader.h:34
boost::shared_ptr< TermEnum > TermEnumPtr
Definition: LuceneTypes.h:235
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
static Collection< IndexCommitPtr > listCommits(const DirectoryPtr &dir)
Returns all commit points that exist in the Directory.
MultiTermEnumPtr tenum
Definition: DirectoryReader.h:243
TermPositions provides an interface for enumerating the <document, frequency, <position>*> tuples for...
Definition: TermPositions.h:18
int32_t _numDocs
Definition: DirectoryReader.h:54
virtual IndexCommitPtr getIndexCommit()
Return the IndexCommit that this reader has opened.
int32_t base
Definition: DirectoryReader.h:238
virtual bool next()
Moves to the next pair in the enumeration.
virtual MapStringString getCommitUserData()
Retrieve the String userData optionally passed to IndexWriter::commit.
virtual IndexReaderPtr reopen()
Refreshes an IndexReader if the index has changed since this instance was (re)opened.
virtual TermDocsPtr termDocs(int32_t i)
MapStringByteArray normsCache
Definition: DirectoryReader.h:52
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index i...
Definition: IndexReader.h:39
boost::shared_ptr< TermFreqVector > TermFreqVectorPtr
Definition: LuceneTypes.h:237
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition: IndexReader.h:48
virtual void doUndeleteAll()
Implements actual undeleteAll() in subclass.
boost::shared_ptr< SegmentMergeInfo > SegmentMergeInfoPtr
Definition: LuceneTypes.h:212
bool _hasDeletions
Definition: DirectoryReader.h:55
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
virtual bool isPayloadAvailable()
Checks if a payload can be loaded at this position.
virtual int64_t getVersion()
Returns the version for this IndexCommit.
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition: LuceneTypes.h:243
MultiTermPositions(const IndexReaderPtr &topReader, Collection< IndexReaderPtr > r, Collection< int32_t > s)
HashSet< String > synced
Definition: DirectoryReader.h:41
int32_t matchingSegmentPos
Definition: DirectoryReader.h:244
MapStringString userData
Definition: DirectoryReader.h:316
Represents a single commit into an index as seen by the IndexDeletionPolicy or IndexReader.
Definition: IndexCommit.h:22
boost::shared_ptr< IndexDeletionPolicy > IndexDeletionPolicyPtr
Definition: LuceneTypes.h:153
virtual bool isOptimized()
Returns true if this commit is an optimized index.
LockPtr writeLock
Definition: DirectoryReader.h:42
virtual void deleteCommit()
Delete this commit point. This only applies when using the commit point in the context of IndexWriter...
boost::shared_ptr< SegmentInfos > SegmentInfosPtr
Definition: LuceneTypes.h:210
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
virtual String toString()
Returns a string representation of the object.
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Definition: DirectoryReader.h:302
SegmentInfosPtr segmentInfos
Definition: DirectoryReader.h:43
virtual ~DirectoryReader()
IndexWriterWeakPtr _writer
Definition: DirectoryReader.h:39
virtual HashSet< String > getFieldNames(FieldOption fieldOption)
Get a list of unique field names that exist in this index and have the specified field option informa...
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
String segmentsFileName
Definition: DirectoryReader.h:307
bool readOnly
Definition: DirectoryReader.h:38
DirectoryReader(const DirectoryPtr &directory, const SegmentInfosPtr &sis, const IndexDeletionPolicyPtr &deletionPolicy, bool readOnly, int32_t termInfosIndexDivisor)
Construct reading the named set of readers.
int64_t version
Definition: DirectoryReader.h:314
virtual TermDocsPtr termDocs(const IndexReaderPtr &reader)
virtual int32_t nextPosition()
Returns next position in the current document.
virtual int32_t doc()
Returns the current document number.
void commit()
Commit changes resulting from delete, undeleteAll, or setNorm operations. If an exception is hit,...
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document.
boost::shared_ptr< IndexWriter > IndexWriterPtr
Definition: LuceneTypes.h:160
virtual void seek(const TermPtr &term)
Sets this to the data for a term.
boost::shared_ptr< MultiTermEnum > MultiTermEnumPtr
Definition: LuceneTypes.h:183
Collection< int32_t > starts
Definition: DirectoryReader.h:51
virtual bool isCurrent()
Check whether any new changes have occurred to the index since this reader was opened.
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
boost::shared_ptr< IndexCommit > IndexCommitPtr
Definition: LuceneTypes.h:152
friend class FindSegmentsReopen
Definition: DirectoryReader.h:192
Collection< int32_t > starts
Definition: DirectoryReader.h:235
int32_t termInfosIndexDivisor
Definition: DirectoryReader.h:46
clucene.sourceforge.net