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 // 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 MERGEPOLICY_H
8 #define MERGEPOLICY_H
9 
10 #include "SegmentInfos.h"
11 
12 namespace Lucene
13 {
32  class LPPAPI MergePolicy : public LuceneObject
33  {
34  public:
36  virtual ~MergePolicy();
37 
39 
40  protected:
41  IndexWriterWeakPtr _writer;
42 
43  public:
48  virtual MergeSpecificationPtr findMerges(SegmentInfosPtr segmentInfos) = 0;
49 
58  virtual MergeSpecificationPtr findMergesForOptimize(SegmentInfosPtr segmentInfos, int32_t maxSegmentCount, SetSegmentInfo segmentsToOptimize) = 0;
59 
62  virtual MergeSpecificationPtr findMergesToExpungeDeletes(SegmentInfosPtr segmentInfos) = 0;
63 
65  virtual void close() = 0;
66 
68  virtual bool useCompoundFile(SegmentInfosPtr segments, SegmentInfoPtr newSegment) = 0;
69 
71  virtual bool useCompoundDocStore(SegmentInfosPtr segments) = 0;
72  };
73 
77  class LPPAPI OneMerge : public LuceneObject
78  {
79  public:
80  OneMerge(SegmentInfosPtr segments, bool useCompoundFile);
81  virtual ~OneMerge();
82 
84 
85  public:
86  SegmentInfoPtr info; // used by IndexWriter
87  bool mergeDocStores; // used by IndexWriter
88  bool optimize; // used by IndexWriter
89  bool registerDone; // used by IndexWriter
90  int64_t mergeGen; // used by IndexWriter
91  bool isExternal; // used by IndexWriter
92  int32_t maxNumSegmentsOptimize; // used by IndexWriter
93  Collection<SegmentReaderPtr> readers; // used by IndexWriter
95 
98  bool aborted;
100 
101  public:
103  void setException(const LuceneException& error);
104 
106  LuceneException getException();
107 
109  void abort();
110 
112  bool isAborted();
113 
114  void checkAborted(DirectoryPtr dir);
115 
116  String segString(DirectoryPtr dir);
117  };
118 
121  class LPPAPI MergeSpecification : public LuceneObject
122  {
123  public:
125  virtual ~MergeSpecification();
126 
128 
129  public:
131 
132  public:
133  void add(OneMergePtr merge);
134  String segString(DirectoryPtr dir);
135  };
136 }
137 
138 #endif

clucene.sourceforge.net