Lucene++ - a full-featured, c++ search engine
API Documentation
A MergePolicy determines the sequence of primitive merge operations to be used for overall merge and optimize operations. More...
#include <MergePolicy.h>
Public Member Functions | |
MergePolicy (const IndexWriterPtr &writer) | |
virtual | ~MergePolicy () |
virtual String | getClassName () |
boost::shared_ptr< MergePolicy > | shared_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. | |
![]() | |
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. | |
![]() | |
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 |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
Additional Inherited Members | |
![]() | |
LuceneObject () | |
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)
Lucene::MergePolicy::MergePolicy | ( | const IndexWriterPtr & | writer | ) |
|
virtual |
|
inlinestatic |
|
pure virtual |
Release all resources for the policy.
Implemented in Lucene::LogMergePolicy.
|
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.
segmentInfos | the total set of segments in the index |
Implemented in Lucene::LogMergePolicy.
|
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.
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.
|
pure virtual |
Determine what set of merge operations is necessary in order to expunge all deletes from the index.
segmentInfos | the total set of segments in the index |
Implemented in Lucene::LogMergePolicy.
|
inlinevirtual |
Reimplemented in Lucene::LogByteSizeMergePolicy, Lucene::LogDocMergePolicy, and Lucene::LogMergePolicy.
|
inline |
|
pure virtual |
Returns true if the doc store files should use the compound file format.
Implemented in Lucene::LogMergePolicy.
|
pure virtual |
Returns true if a newly flushed (not from merge) segment should use the compound file format.
Implemented in Lucene::LogMergePolicy.
|
protected |