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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SegmentMerger.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 SEGMENTMERGER_H
8 #define SEGMENTMERGER_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
20 class SegmentMerger : public LuceneObject {
21 public:
22  SegmentMerger(const DirectoryPtr& dir, const String& name);
23  SegmentMerger(const IndexWriterPtr& writer, const String& name, const OneMergePtr& merge);
24  virtual ~SegmentMerger();
25 
27 
28 protected:
30  String segment;
32 
35 
36  int32_t mergedDocs;
38 
42 
44  static const int32_t MAX_RAW_MERGE_DOCS;
45 
49 
52 
53  ByteArray payloadBuffer;
56 
57 public:
59  static const uint8_t NORMS_HEADER[];
60  static const int32_t NORMS_HEADER_LENGTH;
61 
62 public:
63  bool hasProx();
64 
66  void add(const IndexReaderPtr& reader);
67 
70  IndexReaderPtr segmentReader(int32_t i);
71 
74  int32_t merge();
75 
79  int32_t merge(bool mergeDocStores);
80 
82  void closeReaders();
83 
85  HashSet<String> createCompoundFile(const String& fileName);
86 
88  int32_t mergeFields();
89 
92 
93 protected:
94  void addIndexed(const IndexReaderPtr& reader, const FieldInfosPtr& fInfos, HashSet<String> names, bool storeTermVectors,
95  bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads,
96  bool omitTFAndPositions);
97 
99  int32_t copyFieldsWithDeletions(const FieldsWriterPtr& fieldsWriter, const IndexReaderPtr& reader, const FieldsReaderPtr& matchingFieldsReader);
100  int32_t copyFieldsNoDeletions(const FieldsWriterPtr& fieldsWriter, const IndexReaderPtr& reader, const FieldsReaderPtr& matchingFieldsReader);
101 
103  void mergeVectors();
104 
105  void copyVectorsWithDeletions(const TermVectorsWriterPtr& termVectorsWriter, const TermVectorsReaderPtr& matchingVectorsReader, const IndexReaderPtr& reader);
106  void copyVectorsNoDeletions(const TermVectorsWriterPtr& termVectorsWriter, const TermVectorsReaderPtr& matchingVectorsReader, const IndexReaderPtr& reader);
107 
108  void mergeTerms();
109 
110  void mergeTermInfos(const FormatPostingsFieldsConsumerPtr& consumer);
111 
117  int32_t appendPostings(const FormatPostingsTermsConsumerPtr& termsConsumer, Collection<SegmentMergeInfoPtr> smis, int32_t n);
118 
119  void mergeNorms();
120 };
121 
122 class CheckAbort : public LuceneObject {
123 public:
124  CheckAbort(const OneMergePtr& merge, const DirectoryPtr& dir);
125  virtual ~CheckAbort();
126 
128 
129 protected:
130  double workCount;
133 
134 public:
138  virtual void work(double units);
139 };
140 
141 class CheckAbortNull : public CheckAbort {
142 public:
143  CheckAbortNull();
144  virtual ~CheckAbortNull();
145 
147 
148 public:
150  virtual void work(double units);
151 };
152 
153 }
154 
155 #endif

clucene.sourceforge.net