Lucene++ - a full-featured, c++ search engine
API Documentation
Go to the documentation of this file.
7 #ifndef SEGMENTREADER_H
8 #define SEGMENTREADER_H
44 int32_t readBufferSize;
45 bool deletedDocsDirty;
47 int32_t pendingDeleteCount;
49 bool rollbackHasChanges;
50 bool rollbackDeletedDocsDirty;
51 bool rollbackNormsDirty;
52 int32_t rollbackPendingDeleteCount;
120 virtual ByteArray
norms(
const String& field);
123 virtual void norms(
const String& field, ByteArray norms, int32_t offset);
192 virtual void doCommit(MapStringString commitUserData);
210 virtual void doSetNorm(int32_t doc,
const String& field, uint8_t value);
214 friend class ReaderPool;
virtual DocumentPtr document(int32_t n)
Returns the stored fields of the n'th Document in this index.
FieldInfosPtr fieldInfos()
boost::shared_ptr< SegmentReaderRef > SegmentReaderRefPtr
Definition: LuceneTypes.h:216
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
ByteArray getNorms(const String &field)
can return null if norms aren't stored
boost::shared_ptr< FieldsReaderLocal > FieldsReaderLocalPtr
Definition: LuceneTypes.h:132
virtual BitVectorPtr cloneDeletedDocs(const BitVectorPtr &bv)
Clones the deleteDocs BitVector. May be overridden by subclasses.
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
static SegmentReaderPtr get(bool readOnly, const DirectoryPtr &dir, const SegmentInfoPtr &si, int32_t readBufferSize, bool doOpenStores, int32_t termInfosIndexDivisor)
TermVectorsReaderPtr getTermVectorsReaderOrig()
boost::shared_ptr< Term > TermPtr
Definition: LuceneTypes.h:233
Utility template class to handle collections that can be safely copied and shared.
Definition: Collection.h:17
virtual DirectoryPtr directory()
Returns the directory this index resides in.
virtual bool hasNorms(const String &field)
Returns true if there are norms stored for this field.
boost::shared_ptr< SegmentInfo > SegmentInfoPtr
Definition: LuceneTypes.h:208
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
virtual ByteArray norms(const String &field)
Returns the byte-encoded normalization factor for the named field of every document.
static bool usesCompoundFile(const SegmentInfoPtr &si)
General purpose thread-local map.
Definition: CloseableThreadLocal.h:16
virtual TermPositionsPtr termPositions()
Returns an unpositioned TermPositions enumerator.
virtual LuceneObjectPtr getFieldCacheKey()
This is necessary so that cloned SegmentReaders (which share the underlying postings data) will map t...
boost::shared_ptr< TermVectorMapper > TermVectorMapperPtr
Definition: LuceneTypes.h:254
virtual void getTermFreqVector(int32_t docNumber, const String &field, const TermVectorMapperPtr &mapper)
Load the Term Vector into a user-defined data structure instead of relying on the parallel arrays of ...
static SegmentReaderPtr getOnlySegmentReader(const IndexReaderPtr &reader)
boost::shared_ptr< FieldInfos > FieldInfosPtr
Definition: LuceneTypes.h:127
TermVectorsReaderPtr getTermVectorsReader()
Create a clone from the initial TermVectorsReader and store it in the ThreadLocal.
virtual void commitChanges(MapStringString commitUserData)
virtual void doDelete(int32_t docNum)
Implements deletion of the document numbered docNum. Applications should call deleteDocument(int) or ...
boost::shared_ptr< SegmentReader > SegmentReaderPtr
Definition: LuceneTypes.h:215
boost::shared_ptr< BitVector > BitVectorPtr
Definition: LuceneTypes.h:523
virtual int32_t getTermInfosIndexDivisor()
For IndexReader implementations that use TermInfosReader to read terms, this returns the current inde...
SegmentReaderPtr reopenSegment(const SegmentInfoPtr &si, bool doClone, bool openReadOnly)
String getSegmentName()
Return the name of the segment this reader is reading.
void setSegmentInfo(const SegmentInfoPtr &info)
virtual TermDocsPtr termDocs()
Returns an unpositioned TermDocs enumerator.
bool checkDeletedCounts()
boost::shared_ptr< Document > DocumentPtr
Definition: LuceneTypes.h:74
virtual LuceneObjectPtr clone(bool openReadOnly, const LuceneObjectPtr &other=LuceneObjectPtr())
Clones the IndexReader and optionally changes readOnly. A readOnly reader cannot open a writable read...
virtual void doUndeleteAll()
Implements actual undeleteAll() in subclass.
virtual TermPositionsPtr termPositions()=0
Returns an unpositioned TermPositions enumerator.
Definition: AbstractAllTermDocs.h:12
SegmentReaderRefPtr deletedDocsRef
Definition: SegmentReader.h:27
CloseableThreadLocal< TermVectorsReader > termVectorsLocal
Definition: SegmentReader.h:31
virtual TermEnumPtr terms(const TermPtr &t)
Returns an enumeration of all terms starting at a given term.
boost::shared_ptr< TermEnum > TermEnumPtr
Definition: LuceneTypes.h:235
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition: LuceneTypes.h:157
virtual void getTermFreqVector(int32_t docNumber, const TermVectorMapperPtr &mapper)
Map all the term vectors for all fields in a Document.
boost::shared_ptr< TermDocs > TermDocsPtr
Definition: LuceneTypes.h:236
virtual TermEnumPtr terms()
Returns an enumeration of all the terms in the index.
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493
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 ByteArray cloneNormBytes(ByteArray bytes)
Clones the norm bytes. May be overridden by subclasses.
Definition: SegmentReader.h:15
SegmentInfoPtr rollbackSegmentInfo
Definition: SegmentReader.h:30
void openNorms(const DirectoryPtr &cfsDir, int32_t readBufferSize)
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
virtual int32_t docFreq(const TermPtr &t)
Returns the number of documents containing the term t.
FieldOption
Constants describing field properties, for example used for IndexReader#getFieldNames(FieldOption).
Definition: IndexReader.h:48
FieldsReaderLocalPtr fieldsReaderLocal
Definition: SegmentReader.h:29
virtual LuceneObjectPtr getDeletesCacheKey()
This returns null if the reader has no deletions.
virtual int32_t numDocs()
Returns the number of documents in this index.
boost::shared_ptr< TermPositions > TermPositionsPtr
Definition: LuceneTypes.h:243
boost::shared_ptr< CoreReaders > CoreReadersPtr
Definition: LuceneTypes.h:100
virtual void doClose()
Implements close.
virtual int64_t getUniqueTermCount()
Returns the number of unique terms (across all fields) in this reader.
CoreReadersPtr core
Definition: SegmentReader.h:28
FieldsReaderPtr getFieldsReader()
virtual void doCommit(MapStringString commitUserData)
Implements commit.
static bool hasSeparateNorms(const SegmentInfoPtr &si)
virtual int32_t maxDoc()
Returns one greater than the largest possible document number.
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
static bool hasDeletions(const SegmentInfoPtr &si)
SegmentInfoPtr getSegmentInfo()
Return the SegmentInfo of the segment this reader is reading.
virtual void doSetNorm(int32_t doc, const String &field, uint8_t value)
Implements setNorm in subclass.
virtual TermFreqVectorPtr getTermFreqVector(int32_t docNumber, const String &field)
Return a term frequency vector for the specified document and field. The vector returned contains ter...
boost::shared_ptr< FieldSelector > FieldSelectorPtr
Definition: LuceneTypes.h:77
bool normsClosed(const String &field)
An IndexWriter creates and maintains an index.
Definition: IndexWriter.h:90
HashSet< String > files()
MapStringNorm _norms
Definition: SegmentReader.h:40
boost::shared_ptr< FieldsReader > FieldsReaderPtr
Definition: LuceneTypes.h:131
virtual TermDocsPtr termDocs(const TermPtr &term)
Returns an enumeration of all the documents which contain term.
virtual void norms(const String &field, ByteArray norms, int32_t offset)
Read norms into a pre-allocated array.
boost::shared_ptr< TermVectorsReader > TermVectorsReaderPtr
Definition: LuceneTypes.h:256
virtual bool isDeleted(int32_t n)
Returns true if document n has been deleted.
bool readOnly
Definition: SegmentReader.h:20
void loadTermsIndex(int32_t termsIndexDivisor)
NOTE: only called from IndexWriter when a near real-time reader is opened, or applyDeletes is run,...
virtual DocumentPtr document(int32_t n, const FieldSelectorPtr &fieldSelector)
Get the Document at the n'th position.
virtual bool hasDeletions()
Returns true if any documents have been deleted.
virtual Collection< TermFreqVectorPtr > getTermFreqVectors(int32_t docNumber)
Return an array of term frequency vectors for the specified document. The array contains a vector for...
static SegmentReaderPtr getOnlySegmentReader(const DirectoryPtr &dir)
static SegmentReaderPtr get(bool readOnly, const SegmentInfoPtr &si, int32_t termInfosIndexDivisor)
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Efficiently clones the IndexReader (sharing most internal state).
clucene.sourceforge.net