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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

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< SegmentMerger > | shared_from_this ()
bool | hasProx ()
void | add (const IndexReaderPtr &reader)
| Add an IndexReader to the collection of readers that are to be merged. More...
IndexReaderPtr | segmentReader (int32_t i)
int32_t | merge ()
| Merges the readers specified by the add method into the directory passed to the constructor. More...
int32_t | merge (bool mergeDocStores)
| Merges the readers specified by the add method into the directory passed to the constructor. More...
void | closeReaders ()
| close all IndexReaders that have been added. Should not be called before merge(). More...
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. More...
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Return clone of this object. More...
virtual int32_t | hashCode ()
| Return hash code for this object. More...
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal. More...
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects. More...
virtual String | toString ()
| Returns a string representation of the object. More...
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock. More...
virtual LuceneSignalPtr | getSignal ()
| Return this object signal. More...
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout. More...
virtual void | unlock ()
| Unlock this object. More...
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread. More...
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout. More...
virtual void | notifyAll ()
| Notify all threads waiting for signal. More...

## Static Public Member Functions

static String | _getClassName ()

## Static Public Attributes

static const uint8_t | NORMS_HEADER []
| norms header placeholder More...
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. More...
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. More...
void | mergeNorms ()
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Protected Attributes

DirectoryPtr | directory
String | segment
int32_t | termIndexInterval
Collection< IndexReaderPtr > | readers
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. More...
Collection< SegmentReaderPtr > | matchingSegmentReaders
Collection< int32_t > | rawDocLengths
Collection< int32_t > | rawDocLengths2
SegmentMergeQueuePtr | queue
bool | omitTermFreqAndPositions
ByteArray | payloadBuffer
Collection< Collection< int32_t > > | docMaps
Collection< int32_t > | delCounts
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Static Protected Attributes

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

## 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 | ( |  | ) |

inline static

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

  smis | array of segments
  n | number 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 | ( |  | ) |

inline virtual

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

  mergeDocStores | if 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

  i | The 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

static protected

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:

- SegmentMerger.h

clucene.sourceforge.net