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