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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LogMergePolicy.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 LOGMERGEPOLICY_H
8 #define LOGMERGEPOLICY_H
9 
10 #include "MergePolicy.h"
11 
12 namespace Lucene {
13 
24 class LPPAPI LogMergePolicy : public MergePolicy {
25 public:
26  LogMergePolicy(const IndexWriterPtr& writer);
27  virtual ~LogMergePolicy();
28 
30 
31 protected:
32  int32_t mergeFactor;
33 
34  double noCFSRatio;
35 
39 
40 public:
43  static const double LEVEL_LOG_SPAN;
44 
46  static const int32_t DEFAULT_MERGE_FACTOR;
47 
50  static const int32_t DEFAULT_MAX_MERGE_DOCS;
51 
54  static const double DEFAULT_NO_CFS_RATIO;
55 
56  int64_t minMergeSize;
57  int64_t maxMergeSize;
58  int32_t maxMergeDocs;
59 
60 public:
62  double getNoCFSRatio();
63 
66  void setNoCFSRatio(double noCFSRatio);
67 
70  int32_t getMergeFactor();
71 
77  void setMergeFactor(int32_t mergeFactor);
78 
80  virtual bool useCompoundFile(const SegmentInfosPtr& segments, const SegmentInfoPtr& newSegment);
81 
83  void setUseCompoundFile(bool useCompoundFile);
84 
87  bool getUseCompoundFile();
88 
90  virtual bool useCompoundDocStore(const SegmentInfosPtr& segments);
91 
94  void setUseCompoundDocStore(bool useCompoundDocStore);
95 
98  bool getUseCompoundDocStore();
99 
102  void setCalibrateSizeByDeletes(bool calibrateSizeByDeletes);
103 
106  bool getCalibrateSizeByDeletes();
107 
109  virtual void close();
110 
115  virtual MergeSpecificationPtr findMergesForOptimize(const SegmentInfosPtr& segmentInfos, int32_t maxSegmentCount, SetSegmentInfo segmentsToOptimize);
116 
119  virtual MergeSpecificationPtr findMergesToExpungeDeletes(const SegmentInfosPtr& segmentInfos);
120 
125  virtual MergeSpecificationPtr findMerges(const SegmentInfosPtr& segmentInfos);
126 
135  void setMaxMergeDocs(int32_t maxMergeDocs);
136 
139  int32_t getMaxMergeDocs();
140 
141 protected:
142  bool verbose();
143  void message(const String& message);
144 
145  virtual int64_t size(const SegmentInfoPtr& info) = 0;
146 
147  int64_t sizeDocs(const SegmentInfoPtr& info);
148  int64_t sizeBytes(const SegmentInfoPtr& info);
149 
150  bool isOptimized(const SegmentInfosPtr& infos, int32_t maxNumSegments, SetSegmentInfo segmentsToOptimize);
151 
154  bool isOptimized(const SegmentInfoPtr& info);
155 
156  OneMergePtr makeOneMerge(const SegmentInfosPtr& infos, const SegmentInfosPtr& infosToMerge);
157 };
158 
159 }
160 
161 #endif

clucene.sourceforge.net