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

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

- Data Structures
- Class Hierarchy
- Data Fields

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

A MergePolicy determines the sequence of primitive merge operations to be used for overall merge and optimize operations. More...

`#include <MergePolicy.h>`

Inheritance diagram for Lucene::MergePolicy:

## Public Member Functions

| MergePolicy (IndexWriterPtr writer)
virtual | ~MergePolicy ()
virtual String | getClassName ()
boost::shared_ptr< MergePolicy > | shared_from_this ()
virtual MergeSpecificationPtr | findMerges (SegmentInfosPtr segmentInfos)=0
| Determine what set of merge operations are now necessary on the index. IndexWriter calls this whenever there is a change to the segments. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method. More...
virtual MergeSpecificationPtr | findMergesForOptimize (SegmentInfosPtr segmentInfos, int32_t maxSegmentCount, SetSegmentInfo segmentsToOptimize)=0
| Determine what set of merge operations is necessary in order to optimize the index. IndexWriter calls this when its IndexWriter#optimize() method is called. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method. More...
virtual MergeSpecificationPtr | findMergesToExpungeDeletes (SegmentInfosPtr segmentInfos)=0
| Determine what set of merge operations is necessary in order to expunge all deletes from the index. More...
virtual void | close ()=0
| Release all resources for the policy. More...
virtual bool | useCompoundFile (SegmentInfosPtr segments, SegmentInfoPtr newSegment)=0
| Returns true if a newly flushed (not from merge) segment should use the compound file format. More...
virtual bool | useCompoundDocStore (SegmentInfosPtr segments)=0
| Returns true if the doc store files should use the compound file format. More...
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 (LuceneObjectPtr other=LuceneObjectPtr())
| Return clone of this object. More...
virtual int32_t | hashCode ()
| Return hash code for this object. More...
virtual bool | equals (LuceneObjectPtr other)
| Return whether two objects are equal. More...
virtual int32_t | compareTo (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 ()

## Protected Attributes

IndexWriterWeakPtr | _writer

## Additional Inherited Members

Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Detailed Description

A MergePolicy determines the sequence of primitive merge operations to be used for overall merge and optimize operations.

Whenever the segments in an index have been altered by IndexWriter, either the addition of a newly flushed segment, addition of many segments from addIndexes* calls, or a previous merge that may now need to cascade, IndexWriter invokes findMerges to give the MergePolicy a chance to pick merges that are now required. This method returns a MergeSpecification instance describing the set of merges that should be done, or null if no merges are necessary. When IndexWriter.optimize is called, it calls findMergesForOptimize and the MergePolicy should then return the necessary merges.

Note that the policy can return more than one merge at a time. In this case, if the writer is using SerialMergeScheduler, the merges will be run sequentially but if it is using ConcurrentMergeScheduler they will be run concurrently.

The default MergePolicy is LogByteSizeMergePolicy.

NOTE: This API is new and still experimental (subject to change suddenly in the next release)

## Constructor & Destructor Documentation

Lucene::MergePolicy::MergePolicy | ( | IndexWriterPtr | writer) |  |

virtual Lucene::MergePolicy::~MergePolicy | ( | ) |  |

virtual

## Member Function Documentation

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

inline static

virtual void Lucene::MergePolicy::close | ( | ) |  |

pure virtual

Release all resources for the policy.

Implemented in Lucene::LogMergePolicy.

virtual MergeSpecificationPtr Lucene::MergePolicy::findMerges | ( | SegmentInfosPtr | segmentInfos) |  |

pure virtual

Determine what set of merge operations are now necessary on the index. IndexWriter calls this whenever there is a change to the segments. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method.

Parameters

  segmentInfos | the total set of segments in the index

Implemented in Lucene::LogMergePolicy.

virtual MergeSpecificationPtr Lucene::MergePolicy::findMergesForOptimize | ( | SegmentInfosPtr | segmentInfos,
|  | int32_t | maxSegmentCount,
|  | SetSegmentInfo | segmentsToOptimize
| ) |  |

pure virtual

Determine what set of merge operations is necessary in order to optimize the index. IndexWriter calls this when its IndexWriter#optimize() method is called. This call is always synchronized on the IndexWriter instance so only one thread at a time will call this method.

Parameters

  segmentInfos | the total set of segments in the index
  maxSegmentCount | requested maximum number of segments in the index (currently this is always 1)
  segmentsToOptimize | contains the specific SegmentInfo instances that must be merged away. This may be a subset of all SegmentInfos.

Implemented in Lucene::LogMergePolicy.

virtual MergeSpecificationPtr Lucene::MergePolicy::findMergesToExpungeDeletes | ( | SegmentInfosPtr | segmentInfos) |  |

pure virtual

Determine what set of merge operations is necessary in order to expunge all deletes from the index.

Parameters

  segmentInfos | the total set of segments in the index

Implemented in Lucene::LogMergePolicy.

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

inline virtual

Reimplemented in Lucene::LogMergePolicy, Lucene::LogByteSizeMergePolicy, and Lucene::LogDocMergePolicy.

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

inline

virtual bool Lucene::MergePolicy::useCompoundDocStore | ( | SegmentInfosPtr | segments) |  |

pure virtual

Returns true if the doc store files should use the compound file format.

Implemented in Lucene::LogMergePolicy.

virtual bool Lucene::MergePolicy::useCompoundFile | ( | SegmentInfosPtr | segments,
|  | SegmentInfoPtr | newSegment
| ) |  |

pure virtual

Returns true if a newly flushed (not from merge) segment should use the compound file format.

Implemented in Lucene::LogMergePolicy.

## Field Documentation

IndexWriterWeakPtr Lucene::MergePolicy::_writer

protected

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

- MergePolicy.h

clucene.sourceforge.net