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

Loading...
Searching...
No Matches
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.
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< 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.
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.

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

## ◆ SegmentMerger() [1/2]

Lucene::SegmentMerger::SegmentMerger | ( | const DirectoryPtr & | dir,
|  | const String & | name )

Referenced by _getClassName().

## ◆ SegmentMerger() [2/2]

Lucene::SegmentMerger::SegmentMerger | ( | const IndexWriterPtr & | writer,
|  | const String & | name,
|  | const OneMergePtr & | merge )

References merge().

## ◆ ~SegmentMerger()

virtual Lucene::SegmentMerger::~SegmentMerger | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

String Lucene::SegmentMerger::_getClassName | ( |  | ) |

inline static

References SegmentMerger().

## ◆ add()

void Lucene::SegmentMerger::add | ( | const IndexReaderPtr & | reader | ) |

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

## ◆ addIndexed()

void Lucene::SegmentMerger::addIndexed | ( | const IndexReaderPtr & | reader,
|  | const FieldInfosPtr & | fInfos,
|  | HashSet< String > | names,
|  | bool | storeTermVectors,
|  | bool | storePositionWithTermVector,
|  | bool | storeOffsetWithTermVector,
|  | bool | storePayloads,
|  | bool | omitTFAndPositions )

protected

## ◆ appendPostings()

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

## ◆ closeReaders()

void Lucene::SegmentMerger::closeReaders | ( |  | ) |

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

## ◆ copyFieldsNoDeletions()

int32_t Lucene::SegmentMerger::copyFieldsNoDeletions | ( | const FieldsWriterPtr & | fieldsWriter,
|  | const IndexReaderPtr & | reader,
|  | const FieldsReaderPtr & | matchingFieldsReader )

protected

## ◆ copyFieldsWithDeletions()

int32_t Lucene::SegmentMerger::copyFieldsWithDeletions | ( | const FieldsWriterPtr & | fieldsWriter,
|  | const IndexReaderPtr & | reader,
|  | const FieldsReaderPtr & | matchingFieldsReader )

protected

## ◆ copyVectorsNoDeletions()

void Lucene::SegmentMerger::copyVectorsNoDeletions | ( | const TermVectorsWriterPtr & | termVectorsWriter,
|  | const TermVectorsReaderPtr & | matchingVectorsReader,
|  | const IndexReaderPtr & | reader )

protected

## ◆ copyVectorsWithDeletions()

void Lucene::SegmentMerger::copyVectorsWithDeletions | ( | const TermVectorsWriterPtr & | termVectorsWriter,
|  | const TermVectorsReaderPtr & | matchingVectorsReader,
|  | const IndexReaderPtr & | reader )

protected

## ◆ createCompoundFile()

HashSet< String > Lucene::SegmentMerger::createCompoundFile | ( | const String & | fileName | ) |

## ◆ getClassName()

virtual String Lucene::SegmentMerger::getClassName | ( |  | ) |

inline virtual

## ◆ getDelCounts()

Collection< int32_t > Lucene::SegmentMerger::getDelCounts | ( |  | ) |

## ◆ getDocMaps()

Collection< Collection< int32_t > > Lucene::SegmentMerger::getDocMaps | ( |  | ) |

## ◆ getMergedFiles()

HashSet< String > Lucene::SegmentMerger::getMergedFiles | ( |  | ) |

## ◆ hasProx()

bool Lucene::SegmentMerger::hasProx | ( |  | ) |

## ◆ merge() [1/2]

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

Referenced by SegmentMerger().

## ◆ merge() [2/2]

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

References mergeDocStores.

## ◆ mergeFields()

int32_t Lucene::SegmentMerger::mergeFields | ( |  | ) |

Returns
  The number of documents in all of the readers

## ◆ mergeNorms()

void Lucene::SegmentMerger::mergeNorms | ( |  | ) |

protected

## ◆ mergeTermInfos()

void Lucene::SegmentMerger::mergeTermInfos | ( | const FormatPostingsFieldsConsumerPtr & | consumer | ) |

protected

## ◆ mergeTerms()

void Lucene::SegmentMerger::mergeTerms | ( |  | ) |

protected

## ◆ mergeVectors()

void Lucene::SegmentMerger::mergeVectors | ( |  | ) |

protected

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

## ◆ segmentReader()

IndexReaderPtr Lucene::SegmentMerger::segmentReader | ( | int32_t | i | ) |

Parameters

  i | The index of the reader to return

Returns
  The i'th reader to be merged

## ◆ setMatchingSegmentReaders()

void Lucene::SegmentMerger::setMatchingSegmentReaders | ( |  | ) |

protected

## ◆ shared_from_this()

boost::shared_ptr< SegmentMerger > Lucene::SegmentMerger::shared_from_this | ( |  | ) |

inline

## Field Documentation

## ◆ checkAbort

CheckAbortPtr Lucene::SegmentMerger::checkAbort

protected

## ◆ delCounts

Collection<int32_t> Lucene::SegmentMerger::delCounts

protected

## ◆ directory

DirectoryPtr Lucene::SegmentMerger::directory

protected

## ◆ docMaps

Collection< Collection<int32_t> > Lucene::SegmentMerger::docMaps

protected

## ◆ fieldInfos

FieldInfosPtr Lucene::SegmentMerger::fieldInfos

protected

## ◆ matchingSegmentReaders

Collection<SegmentReaderPtr> Lucene::SegmentMerger::matchingSegmentReaders

protected

## ◆ MAX_RAW_MERGE_DOCS

const int32_t Lucene::SegmentMerger::MAX_RAW_MERGE_DOCS

static protected

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

## ◆ mergedDocs

int32_t Lucene::SegmentMerger::mergedDocs

protected

## ◆ mergeDocStores

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.

Referenced by merge().

## ◆ NORMS_HEADER

const uint8_t Lucene::SegmentMerger::NORMS_HEADER[]

static

norms header placeholder

## ◆ NORMS_HEADER_LENGTH

const int32_t Lucene::SegmentMerger::NORMS_HEADER_LENGTH

static

## ◆ omitTermFreqAndPositions

bool Lucene::SegmentMerger::omitTermFreqAndPositions

protected

## ◆ payloadBuffer

ByteArray Lucene::SegmentMerger::payloadBuffer

protected

## ◆ queue

SegmentMergeQueuePtr Lucene::SegmentMerger::queue

protected

## ◆ rawDocLengths

Collection<int32_t> Lucene::SegmentMerger::rawDocLengths

protected

## ◆ rawDocLengths2

Collection<int32_t> Lucene::SegmentMerger::rawDocLengths2

protected

## ◆ readers

Collection<IndexReaderPtr> Lucene::SegmentMerger::readers

protected

## ◆ segment

String Lucene::SegmentMerger::segment

protected

## ◆ termIndexInterval

int32_t Lucene::SegmentMerger::termIndexInterval

protected

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

- SegmentMerger.h

clucene.sourceforge.net