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

MergePolicy.h
Go to the documentation of this file.
1 // 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::MergePolicy
A MergePolicy determines the sequence of primitive merge operations to be used for overall merge and ...
Definition: MergePolicy.h:32
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Collection< SegmentReaderPtr >
Lucene::OneMergePtr
boost::shared_ptr< OneMerge > OneMergePtr
Definition: LuceneTypes.h:192
Lucene::SegmentInfoPtr
boost::shared_ptr< SegmentInfo > SegmentInfoPtr
Definition: LuceneTypes.h:208
Lucene::OneMerge::registerDone
bool registerDone
Definition: MergePolicy.h:87
Lucene::OneMerge
OneMerge provides the information necessary to perform an individual primitive merge operation,...
Definition: MergePolicy.h:76
SegmentInfos.h
Lucene::OneMerge::readers
Collection< SegmentReaderPtr > readers
Definition: MergePolicy.h:91
Lucene::OneMerge::aborted
bool aborted
Definition: MergePolicy.h:96
Lucene::IndexWriterWeakPtr
boost::weak_ptr< IndexWriter > IndexWriterWeakPtr
Definition: LuceneTypes.h:160
Lucene::OneMerge::mergeDocStores
bool mergeDocStores
Definition: MergePolicy.h:85
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::OneMerge::segments
SegmentInfosPtr segments
Definition: MergePolicy.h:94
Lucene::MergeSpecification
A MergeSpecification instance provides the information necessary to perform multiple merges....
Definition: MergePolicy.h:119
Lucene::LuceneException
Lucene exception container.
Definition: LuceneException.h:15
Lucene::OneMerge::readersClone
Collection< SegmentReaderPtr > readersClone
Definition: MergePolicy.h:92
Lucene::MergeSpecificationPtr
boost::shared_ptr< MergeSpecification > MergeSpecificationPtr
Definition: LuceneTypes.h:176
Lucene::SegmentInfosPtr
boost::shared_ptr< SegmentInfos > SegmentInfosPtr
Definition: LuceneTypes.h:210
Lucene::OneMerge::mergeGen
int64_t mergeGen
Definition: MergePolicy.h:88
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::OneMerge::error
LuceneException error
Definition: MergePolicy.h:97
Lucene::OneMerge::maxNumSegmentsOptimize
int32_t maxNumSegmentsOptimize
Definition: MergePolicy.h:90
Lucene::IndexWriterPtr
boost::shared_ptr< IndexWriter > IndexWriterPtr
Definition: LuceneTypes.h:160
Lucene::OneMerge::useCompoundFile
bool useCompoundFile
Definition: MergePolicy.h:95
Lucene::OneMerge::isExternal
bool isExternal
Definition: MergePolicy.h:89
Lucene::OneMerge::optimize
bool optimize
Definition: MergePolicy.h:86

clucene.sourceforge.net