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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 
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 
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
93 
96  bool aborted;
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:
122  virtual ~MergeSpecification();
123 
125 
126 public:
128 
129 public:
130  void add(const OneMergePtr& merge);
131  String segString(const DirectoryPtr& dir);
132 };
133 
134 }
135 
136 #endif

clucene.sourceforge.net