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

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
Lucene::LogDocMergePolicy Class Reference

This is a LogMergePolicy that measures size of a segment as the number of documents (not taking deletions into account). More...

`#include <LogDocMergePolicy.h>`

Inheritance diagram for Lucene::LogDocMergePolicy:

## Public Member Functions

| LogDocMergePolicy (const IndexWriterPtr &writer)
virtual | ~LogDocMergePolicy ()
virtual String | getClassName ()
boost::shared_ptr< LogDocMergePolicy > | shared_from_this ()
void | setMinMergeDocs (int32_t minMergeDocs)

Sets the minimum size for the lowest level segments. Any segments below this size are considered to be on the same level (even if they vary drastically in size) and will be merged whenever there are mergeFactor of them. This effectively truncates the "long tail" of small segments that would otherwise be created into a single level. If you set this too large, it could greatly increase the merging cost during indexing (if you flush many small segments). More...

int32_t | getMinMergeDocs ()
| Get the minimum size for a segment to remain un-merged. More...
Public Member Functions inherited from Lucene::LogMergePolicy
| LogMergePolicy (const IndexWriterPtr &writer)
virtual | ~LogMergePolicy ()
boost::shared_ptr< LogMergePolicy > | shared_from_this ()
double | getNoCFSRatio ()
void | setNoCFSRatio (double noCFSRatio)
| If a merged segment will be more than this percentage of the total size of the index, leave the segment as non-compound file even if compound file is enabled. Set to 1.0 to always use CFS regardless of merge size. More...
int32_t | getMergeFactor ()
| Returns the number of segments that are merged at once and also controls the total number of segments allowed to accumulate in the index. More...
void | setMergeFactor (int32_t mergeFactor)

Determines how often segment indices are merged by addDocument(). With smaller values, less RAM is used while indexing, and searches on unoptimized indices are faster, but indexing speed is slower. With larger values, more RAM is used during indexing, and while searches on unoptimized indices are slower, indexing is faster. Thus larger values (> 10) are best for batch index creation, and smaller values (< 10) for indices that are interactively maintained. More...

virtual bool | useCompoundFile (const SegmentInfosPtr &segments, const SegmentInfoPtr &newSegment)
| Returns true if a newly flushed (not from merge) segment should use the compound file format. More...
void | setUseCompoundFile (bool useCompoundFile)
| Sets whether compound file format should be used for newly flushed and newly merged segments. More...
bool | getUseCompoundFile ()
| Returns true if newly flushed and newly merge segments are written in compound file format. More...
virtual bool | useCompoundDocStore (const SegmentInfosPtr &segments)
| Returns true if the doc store files should use the compound file format. More...
void | setUseCompoundDocStore (bool useCompoundDocStore)
| Sets whether compound file format should be used for newly flushed and newly merged doc store segment files (term vectors and stored fields). More...
bool | getUseCompoundDocStore ()
| Returns true if newly flushed and newly merge doc store segment files (term vectors and stored fields) are written in compound file format. More...
void | setCalibrateSizeByDeletes (bool calibrateSizeByDeletes)
| Sets whether the segment size should be calibrated by the number of deletes when choosing segments for merge. More...
bool | getCalibrateSizeByDeletes ()
| Returns true if the segment size should be calibrated by the number of deletes when choosing segments for merge. More...
virtual void | close ()
| Release all resources for the policy. More...
virtual MergeSpecificationPtr | findMergesForOptimize (const SegmentInfosPtr &segmentInfos, int32_t maxSegmentCount, SetSegmentInfo segmentsToOptimize)

Returns the merges necessary to optimize the index. This merge policy defines "optimized" to mean only one segment in the index, where that segment has no deletions pending nor separate norms, and it is in compound file format if the current useCompoundFile setting is true. This method returns multiple merges (mergeFactor at a time) so the MergeScheduler in use may make use of concurrency. More...

virtual MergeSpecificationPtr | findMergesToExpungeDeletes (const SegmentInfosPtr &segmentInfos)
| Finds merges necessary to expunge all deletes from the index. We simply merge adjacent segments that have deletes, up to mergeFactor at a time. More...
virtual MergeSpecificationPtr | findMerges (const SegmentInfosPtr &segmentInfos)
| Checks if any merges are now necessary and returns a MergePolicy.MergeSpecification if so. A merge is necessary when there are more than setMergeFactor segments at a given level. When multiple levels have too many segments, this method will return multiple merges, allowing the MergeScheduler to use concurrency. More...
void | setMaxMergeDocs (int32_t maxMergeDocs)
| Determines the largest segment (measured by document count) that may be merged with other segments. Small values (eg., less than 10,000) are best for interactive indexing, as this limits the length of pauses while indexing to a few seconds. Larger values are best for batched indexing and speedier searches. More...
int32_t | getMaxMergeDocs ()
| Returns the largest segment (measured by document count) that may be merged with other segments. More...
Public Member Functions inherited from Lucene::MergePolicy
| MergePolicy (const IndexWriterPtr &writer)
virtual | ~MergePolicy ()
boost::shared_ptr< MergePolicy > | shared_from_this ()
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 Member Functions inherited from Lucene::LogMergePolicy
static String | _getClassName ()
Static Public Member Functions inherited from Lucene::MergePolicy
static String | _getClassName ()

## Static Public Attributes

static const int32_t | DEFAULT_MIN_MERGE_DOCS
| Default minimum segment size. More...
Static Public Attributes inherited from Lucene::LogMergePolicy
static const double | LEVEL_LOG_SPAN
| Defines the allowed range of log(size) for each level. A level is computed by taking the max segment log size, minus LEVEL_LOG_SPAN, and finding all segments falling within that range. More...
static const int32_t | DEFAULT_MERGE_FACTOR
| Default merge factor, which is how many segments are merged at a time. More...
static const int32_t | DEFAULT_MAX_MERGE_DOCS
| Default maximum segment size. A segment of this size or larger will never be merged. More...
static const double | DEFAULT_NO_CFS_RATIO
| Default noCFSRatio. If a merge's size is >= 10% of the index, then we disable compound file for it. More...

## Protected Member Functions

virtual int64_t | size (const SegmentInfoPtr &info)
Protected Member Functions inherited from Lucene::LogMergePolicy
bool | verbose ()
void | message (const String &message)
int64_t | sizeDocs (const SegmentInfoPtr &info)
int64_t | sizeBytes (const SegmentInfoPtr &info)
bool | isOptimized (const SegmentInfosPtr &infos, int32_t maxNumSegments, SetSegmentInfo segmentsToOptimize)
bool | isOptimized (const SegmentInfoPtr &info)
| Returns true if this single info is optimized (has no pending norms or deletes, is in the same dir as the writer, and matches the current compound file setting. More...
OneMergePtr | makeOneMerge (const SegmentInfosPtr &infos, const SegmentInfosPtr &infosToMerge)
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Additional Inherited Members

Data Fields inherited from Lucene::LogMergePolicy
int64_t | minMergeSize
int64_t | maxMergeSize
int32_t | maxMergeDocs
Protected Attributes inherited from Lucene::LogMergePolicy
int32_t | mergeFactor
double | noCFSRatio
bool | calibrateSizeByDeletes
bool | _useCompoundFile
bool | _useCompoundDocStore
Protected Attributes inherited from Lucene::MergePolicy
IndexWriterWeakPtr | _writer
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Detailed Description

This is a LogMergePolicy that measures size of a segment as the number of documents (not taking deletions into account).

## Constructor & Destructor Documentation

## ◆ LogDocMergePolicy()

Lucene::LogDocMergePolicy::LogDocMergePolicy | ( | const IndexWriterPtr & | writer | ) |

## ◆ ~LogDocMergePolicy()

virtual Lucene::LogDocMergePolicy::~LogDocMergePolicy | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

static String Lucene::LogDocMergePolicy::_getClassName | ( |  | ) |

inline static

## ◆ getClassName()

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

inline virtual

Reimplemented from Lucene::LogMergePolicy.

## ◆ getMinMergeDocs()

int32_t Lucene::LogDocMergePolicy::getMinMergeDocs | ( |  | ) |

Get the minimum size for a segment to remain un-merged.

See also
  setMinMergeDocs

## ◆ setMinMergeDocs()

void Lucene::LogDocMergePolicy::setMinMergeDocs | ( | int32_t | minMergeDocs | ) |

Sets the minimum size for the lowest level segments. Any segments below this size are considered to be on the same level (even if they vary drastically in size) and will be merged whenever there are mergeFactor of them. This effectively truncates the "long tail" of small segments that would otherwise be created into a single level. If you set this too large, it could greatly increase the merging cost during indexing (if you flush many small segments).

## ◆ shared_from_this()

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

inline

## ◆ size()

virtual int64_t Lucene::LogDocMergePolicy::size | ( | const SegmentInfoPtr & | info | ) |

protected virtual

Implements Lucene::LogMergePolicy.

## Field Documentation

## ◆ DEFAULT_MIN_MERGE_DOCS

const int32_t Lucene::LogDocMergePolicy::DEFAULT_MIN_MERGE_DOCS

static

Default minimum segment size.

See also
  setMinMergeDocs

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

- LogDocMergePolicy.h

clucene.sourceforge.net