Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
Lucene::SegmentMerger Class Reference

The SegmentMerger class combines two or more Segments, represented by an IndexReader (add, into a single Segment. After adding the appropriate readers, call the merge method to combine the segments. More...

#include <SegmentMerger.h>

+ Inheritance diagram for Lucene::SegmentMerger:

Public Member Functions

 SegmentMerger (const DirectoryPtr &dir, const String &name)
 SegmentMerger (const IndexWriterPtr &writer, const String &name, const OneMergePtr &merge)
virtual ~SegmentMerger ()
virtual String getClassName ()
boost::shared_ptr< SegmentMergershared_from_this ()
bool hasProx ()
void add (const IndexReaderPtr &reader)
 Add an IndexReader to the collection of readers that are to be merged.
IndexReaderPtr segmentReader (int32_t i)
int32_t merge ()
 Merges the readers specified by the add method into the directory passed to the constructor.
int32_t merge (bool mergeDocStores)
 Merges the readers specified by the add method into the directory passed to the constructor.
void closeReaders ()
 close all IndexReaders that have been added. Should not be called before merge().
HashSet< String > getMergedFiles ()
HashSet< String > createCompoundFile (const String &fileName)
int32_t mergeFields ()
Collection< Collection< int32_t > > getDocMaps ()
Collection< int32_t > getDelCounts ()
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
virtual int32_t hashCode ()
 Return hash code for this object.
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
virtual String toString ()
 Returns a string representation of the object.
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
virtual void unlock ()
 Unlock this object.
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
virtual void notifyAll ()
 Notify all threads waiting for signal.

Static Public Member Functions

static String _getClassName ()

Static Public Attributes

static const uint8_t NORMS_HEADER []
 norms header placeholder
static const int32_t NORMS_HEADER_LENGTH

Protected Member Functions

void addIndexed (const IndexReaderPtr &reader, const FieldInfosPtr &fInfos, HashSet< String > names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads, bool omitTFAndPositions)
void setMatchingSegmentReaders ()
int32_t copyFieldsWithDeletions (const FieldsWriterPtr &fieldsWriter, const IndexReaderPtr &reader, const FieldsReaderPtr &matchingFieldsReader)
int32_t copyFieldsNoDeletions (const FieldsWriterPtr &fieldsWriter, const IndexReaderPtr &reader, const FieldsReaderPtr &matchingFieldsReader)
void mergeVectors ()
 Merge the TermVectors from each of the segments into the new one.
void copyVectorsWithDeletions (const TermVectorsWriterPtr &termVectorsWriter, const TermVectorsReaderPtr &matchingVectorsReader, const IndexReaderPtr &reader)
void copyVectorsNoDeletions (const TermVectorsWriterPtr &termVectorsWriter, const TermVectorsReaderPtr &matchingVectorsReader, const IndexReaderPtr &reader)
void mergeTerms ()
void mergeTermInfos (const FormatPostingsFieldsConsumerPtr &consumer)
int32_t appendPostings (const FormatPostingsTermsConsumerPtr &termsConsumer, Collection< SegmentMergeInfoPtr > smis, int32_t n)
 Process postings from multiple segments all positioned on the same term. Writes out merged entries into freqOutput and the proxOutput streams.
void mergeNorms ()
- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()

Protected Attributes

DirectoryPtr directory
String segment
int32_t termIndexInterval
Collection< IndexReaderPtrreaders
FieldInfosPtr fieldInfos
int32_t mergedDocs
CheckAbortPtr checkAbort
bool mergeDocStores
 Whether we should merge doc stores (stored fields and vectors files). When all segments we are merging already share the same doc store files, we don't need to merge the doc stores.
Collection< SegmentReaderPtrmatchingSegmentReaders
Collection< int32_t > rawDocLengths
Collection< int32_t > rawDocLengths2
SegmentMergeQueuePtr queue
bool omitTermFreqAndPositions
ByteArray payloadBuffer
Collection< Collection< int32_t > > docMaps
Collection< int32_t > delCounts

Static Protected Attributes

static const int32_t MAX_RAW_MERGE_DOCS
 Maximum number of contiguous documents to bulk-copy when merging stored fields.

Detailed Description

The SegmentMerger class combines two or more Segments, represented by an IndexReader (add, into a single Segment. After adding the appropriate readers, call the merge method to combine the segments.

If the compoundFile flag is set, then the segments will be merged into a compound file.

See Also
merge
add

Constructor & Destructor Documentation

Lucene::SegmentMerger::SegmentMerger ( const DirectoryPtr dir,
const String &  name 
)
Lucene::SegmentMerger::SegmentMerger ( const IndexWriterPtr writer,
const String &  name,
const OneMergePtr merge 
)
virtual Lucene::SegmentMerger::~SegmentMerger ( )
virtual

Member Function Documentation

static String Lucene::SegmentMerger::_getClassName ( )
inlinestatic
void Lucene::SegmentMerger::add ( const IndexReaderPtr reader)

Add an IndexReader to the collection of readers that are to be merged.

void Lucene::SegmentMerger::addIndexed ( const IndexReaderPtr reader,
const FieldInfosPtr fInfos,
HashSet< String >  names,
bool  storeTermVectors,
bool  storePositionWithTermVector,
bool  storeOffsetWithTermVector,
bool  storePayloads,
bool  omitTFAndPositions 
)
protected
int32_t Lucene::SegmentMerger::appendPostings ( const FormatPostingsTermsConsumerPtr termsConsumer,
Collection< SegmentMergeInfoPtr smis,
int32_t  n 
)
protected

Process postings from multiple segments all positioned on the same term. Writes out merged entries into freqOutput and the proxOutput streams.

Parameters
smisarray of segments
nnumber of cells in the array actually occupied
Returns
number of documents across all segments where this term was found
void Lucene::SegmentMerger::closeReaders ( )

close all IndexReaders that have been added. Should not be called before merge().

int32_t Lucene::SegmentMerger::copyFieldsNoDeletions ( const FieldsWriterPtr fieldsWriter,
const IndexReaderPtr reader,
const FieldsReaderPtr matchingFieldsReader 
)
protected
int32_t Lucene::SegmentMerger::copyFieldsWithDeletions ( const FieldsWriterPtr fieldsWriter,
const IndexReaderPtr reader,
const FieldsReaderPtr matchingFieldsReader 
)
protected
void Lucene::SegmentMerger::copyVectorsNoDeletions ( const TermVectorsWriterPtr termVectorsWriter,
const TermVectorsReaderPtr matchingVectorsReader,
const IndexReaderPtr reader 
)
protected
void Lucene::SegmentMerger::copyVectorsWithDeletions ( const TermVectorsWriterPtr termVectorsWriter,
const TermVectorsReaderPtr matchingVectorsReader,
const IndexReaderPtr reader 
)
protected
HashSet<String> Lucene::SegmentMerger::createCompoundFile ( const String &  fileName)
virtual String Lucene::SegmentMerger::getClassName ( )
inlinevirtual
Collection<int32_t> Lucene::SegmentMerger::getDelCounts ( )
Collection< Collection<int32_t> > Lucene::SegmentMerger::getDocMaps ( )
HashSet<String> Lucene::SegmentMerger::getMergedFiles ( )
bool Lucene::SegmentMerger::hasProx ( )
int32_t Lucene::SegmentMerger::merge ( )

Merges the readers specified by the add method into the directory passed to the constructor.

Returns
The number of documents that were merged
int32_t Lucene::SegmentMerger::merge ( bool  mergeDocStores)

Merges the readers specified by the add method into the directory passed to the constructor.

Parameters
mergeDocStoresif false, we will not merge the stored fields nor vectors files
Returns
The number of documents that were merged
int32_t Lucene::SegmentMerger::mergeFields ( )
Returns
The number of documents in all of the readers
void Lucene::SegmentMerger::mergeNorms ( )
protected
void Lucene::SegmentMerger::mergeTermInfos ( const FormatPostingsFieldsConsumerPtr consumer)
protected
void Lucene::SegmentMerger::mergeTerms ( )
protected
void Lucene::SegmentMerger::mergeVectors ( )
protected

Merge the TermVectors from each of the segments into the new one.

IndexReaderPtr Lucene::SegmentMerger::segmentReader ( int32_t  i)
Parameters
iThe index of the reader to return
Returns
The i'th reader to be merged
void Lucene::SegmentMerger::setMatchingSegmentReaders ( )
protected
boost::shared_ptr< SegmentMerger > Lucene::SegmentMerger::shared_from_this ( )
inline

Field Documentation

CheckAbortPtr Lucene::SegmentMerger::checkAbort
protected
Collection<int32_t> Lucene::SegmentMerger::delCounts
protected
DirectoryPtr Lucene::SegmentMerger::directory
protected
Collection< Collection<int32_t> > Lucene::SegmentMerger::docMaps
protected
FieldInfosPtr Lucene::SegmentMerger::fieldInfos
protected
Collection<SegmentReaderPtr> Lucene::SegmentMerger::matchingSegmentReaders
protected
const int32_t Lucene::SegmentMerger::MAX_RAW_MERGE_DOCS
staticprotected

Maximum number of contiguous documents to bulk-copy when merging stored fields.

int32_t Lucene::SegmentMerger::mergedDocs
protected
bool Lucene::SegmentMerger::mergeDocStores
protected

Whether we should merge doc stores (stored fields and vectors files). When all segments we are merging already share the same doc store files, we don't need to merge the doc stores.

const uint8_t Lucene::SegmentMerger::NORMS_HEADER[]
static

norms header placeholder

const int32_t Lucene::SegmentMerger::NORMS_HEADER_LENGTH
static
bool Lucene::SegmentMerger::omitTermFreqAndPositions
protected
ByteArray Lucene::SegmentMerger::payloadBuffer
protected
SegmentMergeQueuePtr Lucene::SegmentMerger::queue
protected
Collection<int32_t> Lucene::SegmentMerger::rawDocLengths
protected
Collection<int32_t> Lucene::SegmentMerger::rawDocLengths2
protected
Collection<IndexReaderPtr> Lucene::SegmentMerger::readers
protected
String Lucene::SegmentMerger::segment
protected
int32_t Lucene::SegmentMerger::termIndexInterval
protected

The documentation for this class was generated from the following file:

clucene.sourceforge.net