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


Loading...
Searching...
No Matches
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 (const IndexWriterPtr &writer)
 
virtual ~MergePolicy ()
 
virtual String getClassName ()
 
boost::shared_ptr< MergePolicyshared_from_this ()
 
virtual MergeSpecificationPtr findMerges (const 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.
 
virtual MergeSpecificationPtr findMergesForOptimize (const 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.
 
virtual MergeSpecificationPtr findMergesToExpungeDeletes (const SegmentInfosPtr &segmentInfos)=0
 Determine what set of merge operations is necessary in order to expunge all deletes from the index.
 
virtual void close ()=0
 Release all resources for the policy.
 
virtual bool useCompoundFile (const SegmentInfosPtr &segments, const SegmentInfoPtr &newSegment)=0
 Returns true if a newly flushed (not from merge) segment should use the compound file format.
 
virtual bool useCompoundDocStore (const SegmentInfosPtr &segments)=0
 Returns true if the doc store files should use the compound file format.
 
- 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 ()
 

Protected Attributes

IndexWriterWeakPtr _writer
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

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

◆ MergePolicy()

Lucene::MergePolicy::MergePolicy ( const IndexWriterPtr writer)

◆ ~MergePolicy()

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

Member Function Documentation

◆ _getClassName()

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

◆ close()

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

Release all resources for the policy.

Implemented in Lucene::LogMergePolicy.

◆ findMerges()

virtual MergeSpecificationPtr Lucene::MergePolicy::findMerges ( const 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
segmentInfosthe total set of segments in the index

Implemented in Lucene::LogMergePolicy.

◆ findMergesForOptimize()

virtual MergeSpecificationPtr Lucene::MergePolicy::findMergesForOptimize ( const 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
segmentInfosthe total set of segments in the index
maxSegmentCountrequested maximum number of segments in the index (currently this is always 1)
segmentsToOptimizecontains the specific SegmentInfo instances that must be merged away. This may be a subset of all SegmentInfos.

Implemented in Lucene::LogMergePolicy.

◆ findMergesToExpungeDeletes()

virtual MergeSpecificationPtr Lucene::MergePolicy::findMergesToExpungeDeletes ( const SegmentInfosPtr segmentInfos)
pure virtual

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

Parameters
segmentInfosthe total set of segments in the index

Implemented in Lucene::LogMergePolicy.

◆ getClassName()

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

◆ shared_from_this()

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

◆ useCompoundDocStore()

virtual bool Lucene::MergePolicy::useCompoundDocStore ( const SegmentInfosPtr segments)
pure virtual

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

Implemented in Lucene::LogMergePolicy.

◆ useCompoundFile()

virtual bool Lucene::MergePolicy::useCompoundFile ( const SegmentInfosPtr segments,
const 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

◆ _writer

IndexWriterWeakPtr Lucene::MergePolicy::_writer
protected

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

clucene.sourceforge.net