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

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

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LogMergePolicy.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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 LOGMERGEPOLICY_H
8 #define LOGMERGEPOLICY_H
9
10 #include "MergePolicy.h"
11
12 namespace Lucene
13 {
24 class LPPAPI LogMergePolicy : public MergePolicy
25 {
26 public:
27 LogMergePolicy(IndexWriterPtr writer);
28 virtual ~LogMergePolicy();
29
30 LUCENE_CLASS(LogMergePolicy);
31
32 protected:
33 int32_t mergeFactor;
34
35 double noCFSRatio;
36
37 bool calibrateSizeByDeletes;
38 bool _useCompoundFile;
39 bool _useCompoundDocStore;
40
41 public:
44 static const double LEVEL_LOG_SPAN;
45
47 static const int32_t DEFAULT_MERGE_FACTOR;
48
51 static const int32_t DEFAULT_MAX_MERGE_DOCS;
52
55 static const double DEFAULT_NO_CFS_RATIO;
56
57 int64_t minMergeSize;
58 int64_t maxMergeSize;
59 int32_t maxMergeDocs;
60
61 public:
63 double getNoCFSRatio();
64
67 void setNoCFSRatio(double noCFSRatio);
68
71 int32_t getMergeFactor();
72
78 void setMergeFactor(int32_t mergeFactor);
79
81 virtual bool useCompoundFile(SegmentInfosPtr segments, SegmentInfoPtr newSegment);
82
84 void setUseCompoundFile(bool useCompoundFile);
85
88 bool getUseCompoundFile();
89
91 virtual bool useCompoundDocStore(SegmentInfosPtr segments);
92
95 void setUseCompoundDocStore(bool useCompoundDocStore);
96
99 bool getUseCompoundDocStore();
100
103 void setCalibrateSizeByDeletes(bool calibrateSizeByDeletes);
104
107 bool getCalibrateSizeByDeletes();
108
110 virtual void close();
111
116 virtual MergeSpecificationPtr findMergesForOptimize(SegmentInfosPtr segmentInfos, int32_t maxSegmentCount, SetSegmentInfo segmentsToOptimize);
117
120 virtual MergeSpecificationPtr findMergesToExpungeDeletes(SegmentInfosPtr segmentInfos);
121
126 virtual MergeSpecificationPtr findMerges(SegmentInfosPtr segmentInfos);
127
136 void setMaxMergeDocs(int32_t maxMergeDocs);
137
140 int32_t getMaxMergeDocs();
141
142 protected:
143 bool verbose();
144 void message(const String& message);
145
146 virtual int64_t size(SegmentInfoPtr info) = 0;
147
148 int64_t sizeDocs(SegmentInfoPtr info);
149 int64_t sizeBytes(SegmentInfoPtr info);
150
151 bool isOptimized(SegmentInfosPtr infos, int32_t maxNumSegments, SetSegmentInfo segmentsToOptimize);
152
155 bool isOptimized(SegmentInfoPtr info);
156
157 OneMergePtr makeOneMerge(SegmentInfosPtr infos, SegmentInfosPtr infosToMerge);
158 };
159 }
160
161 #endif

clucene.sourceforge.net