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

Loading...
Searching...
No Matches
MergePolicy.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef MERGEPOLICY_H
8#define MERGEPOLICY_H
9
10#include "SegmentInfos.h"
11
12 namespace Lucene {
13
32 class LPPAPI MergePolicy : public LuceneObject {
33 public:
34 MergePolicy(const IndexWriterPtr& writer);
35 virtual ~MergePolicy();
36
37 LUCENE_CLASS(MergePolicy);
38
39 protected:
40 IndexWriterWeakPtr _writer;
41
42 public:
47 virtual MergeSpecificationPtr findMerges(const SegmentInfosPtr& segmentInfos) = 0;
48
57 virtual MergeSpecificationPtr findMergesForOptimize(const SegmentInfosPtr& segmentInfos, int32_t maxSegmentCount, SetSegmentInfo segmentsToOptimize) = 0;
58
61 virtual MergeSpecificationPtr findMergesToExpungeDeletes(const SegmentInfosPtr& segmentInfos) = 0;
62
64 virtual void close() = 0;
65
67 virtual bool useCompoundFile(const SegmentInfosPtr& segments, const SegmentInfoPtr& newSegment) = 0;
68
70 virtual bool useCompoundDocStore(const SegmentInfosPtr& segments) = 0;
71};
72
76 class LPPAPI OneMerge : public LuceneObject {
77 public:
78 OneMerge(const SegmentInfosPtr& segments, bool useCompoundFile);
79 virtual ~OneMerge();
80
81 LUCENE_CLASS(OneMerge);
82
83 public:
84 SegmentInfoPtr info; // used by IndexWriter
85 bool mergeDocStores; // used by IndexWriter
86 bool optimize; // used by IndexWriter
87 bool registerDone; // used by IndexWriter
88 int64_t mergeGen; // used by IndexWriter
89 bool isExternal; // used by IndexWriter
90 int32_t maxNumSegmentsOptimize; // used by IndexWriter
91 Collection<SegmentReaderPtr> readers; // used by IndexWriter
92 Collection<SegmentReaderPtr> readersClone; // used by IndexWriter
93
94 SegmentInfosPtr segments;
95 bool useCompoundFile;
96 bool aborted;
97 LuceneException error;
98
99 public:
101 void setException(const LuceneException& error);
102
104 LuceneException getException();
105
107 void abort();
108
110 bool isAborted();
111
112 void checkAborted(const DirectoryPtr& dir);
113
114 String segString(const DirectoryPtr& dir);
115};
116
119 class LPPAPI MergeSpecification : public LuceneObject {
120 public:
121 MergeSpecification();
122 virtual ~MergeSpecification();
123
124 LUCENE_CLASS(MergeSpecification);
125
126 public:
127 Collection<OneMergePtr> merges;
128
129 public:
130 void add(const OneMergePtr& merge);
131 String segString(const DirectoryPtr& dir);
132};
133
134}
135
136#endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
SegmentInfos.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::LuceneException
Lucene exception container.
Definition LuceneException.h:15
Lucene::LuceneObject
Base class for all Lucene classes.
Definition LuceneObject.h:31
Lucene::MergePolicy
A MergePolicy determines the sequence of primitive merge operations to be used for overall merge and ...
Definition MergePolicy.h:32
Lucene::MergePolicy::useCompoundDocStore
virtual bool useCompoundDocStore(const SegmentInfosPtr &segments)=0
Returns true if the doc store files should use the compound file format.
Lucene::MergePolicy::useCompoundFile
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.
Lucene::MergePolicy::~MergePolicy
virtual ~MergePolicy()
Lucene::MergePolicy::findMergesToExpungeDeletes
virtual MergeSpecificationPtr findMergesToExpungeDeletes(const SegmentInfosPtr &segmentInfos)=0
Determine what set of merge operations is necessary in order to expunge all deletes from the index.
Lucene::MergePolicy::MergePolicy
MergePolicy(const IndexWriterPtr &writer)
Lucene::MergePolicy::_writer
IndexWriterWeakPtr _writer
Definition MergePolicy.h:40
Lucene::MergePolicy::close
virtual void close()=0
Release all resources for the policy.
Lucene::MergePolicy::findMerges
virtual MergeSpecificationPtr findMerges(const SegmentInfosPtr &segmentInfos)=0
Determine what set of merge operations are now necessary on the index. IndexWriter calls this wheneve...
Lucene::MergePolicy::findMergesForOptimize
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....
Lucene::MergeSpecification
A MergeSpecification instance provides the information necessary to perform multiple merges....
Definition MergePolicy.h:119
Lucene::MergeSpecification::MergeSpecification
MergeSpecification()
Lucene::MergeSpecification::~MergeSpecification
virtual ~MergeSpecification()
Lucene::MergeSpecification::segString
String segString(const DirectoryPtr &dir)
Lucene::MergeSpecification::add
void add(const OneMergePtr &merge)
Lucene::MergeSpecification::merges
Collection< OneMergePtr > merges
Definition MergePolicy.h:127
Lucene::OneMerge
OneMerge provides the information necessary to perform an individual primitive merge operation,...
Definition MergePolicy.h:76
Lucene::OneMerge::isExternal
bool isExternal
Definition MergePolicy.h:89
Lucene::OneMerge::getException
LuceneException getException()
Retrieve previous exception set by setException.
Lucene::OneMerge::setException
void setException(const LuceneException &error)
Record that an exception occurred while executing this merge.
Lucene::OneMerge::readers
Collection< SegmentReaderPtr > readers
Definition MergePolicy.h:91
Lucene::OneMerge::error
LuceneException error
Definition MergePolicy.h:97
Lucene::OneMerge::optimize
bool optimize
Definition MergePolicy.h:86
Lucene::OneMerge::OneMerge
OneMerge(const SegmentInfosPtr &segments, bool useCompoundFile)
Lucene::OneMerge::isAborted
bool isAborted()
Returns true if this merge was aborted.
Lucene::OneMerge::useCompoundFile
bool useCompoundFile
Definition MergePolicy.h:95
Lucene::OneMerge::mergeDocStores
bool mergeDocStores
Definition MergePolicy.h:85
Lucene::OneMerge::mergeGen
int64_t mergeGen
Definition MergePolicy.h:88
Lucene::OneMerge::aborted
bool aborted
Definition MergePolicy.h:96
Lucene::OneMerge::readersClone
Collection< SegmentReaderPtr > readersClone
Definition MergePolicy.h:92
Lucene::OneMerge::abort
void abort()
Mark this merge as aborted. If this is called before the merge is committed then the merge will not b...
Lucene::OneMerge::~OneMerge
virtual ~OneMerge()
Lucene::OneMerge::maxNumSegmentsOptimize
int32_t maxNumSegmentsOptimize
Definition MergePolicy.h:90
Lucene::OneMerge::info
SegmentInfoPtr info
Definition MergePolicy.h:84
Lucene::OneMerge::segments
SegmentInfosPtr segments
Definition MergePolicy.h:94
Lucene::OneMerge::registerDone
bool registerDone
Definition MergePolicy.h:87
Lucene::OneMerge::checkAborted
void checkAborted(const DirectoryPtr &dir)
Lucene::OneMerge::segString
String segString(const DirectoryPtr &dir)
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::IndexWriterWeakPtr
boost::weak_ptr< IndexWriter > IndexWriterWeakPtr
Definition LuceneTypes.h:160
Lucene::OneMergePtr
boost::shared_ptr< OneMerge > OneMergePtr
Definition LuceneTypes.h:192
Lucene::MergeSpecificationPtr
boost::shared_ptr< MergeSpecification > MergeSpecificationPtr
Definition LuceneTypes.h:176
Lucene::SegmentInfoPtr
boost::shared_ptr< SegmentInfo > SegmentInfoPtr
Definition LuceneTypes.h:208
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition LuceneTypes.h:489
Lucene::SegmentInfosPtr
boost::shared_ptr< SegmentInfos > SegmentInfosPtr
Definition LuceneTypes.h:210
Lucene::IndexWriterPtr
boost::shared_ptr< IndexWriter > IndexWriterPtr
Definition LuceneTypes.h:160

clucene.sourceforge.net