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
SegmentMerger.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 SEGMENTMERGER_H
8 #define SEGMENTMERGER_H
9
10 #include "LuceneObject.h"
11
12 namespace Lucene
13 {
20 class SegmentMerger : public LuceneObject
21 {
22 public:
23 SegmentMerger(DirectoryPtr dir, const String& name);
24 SegmentMerger(IndexWriterPtr writer, const String& name, OneMergePtr merge);
25 virtual ~SegmentMerger();
26
27 LUCENE_CLASS(SegmentMerger);
28
29 protected:
30 DirectoryPtr directory;
31 String segment;
32 int32_t termIndexInterval;
33
34 Collection<IndexReaderPtr> readers;
35 FieldInfosPtr fieldInfos;
36
37 int32_t mergedDocs;
38 CheckAbortPtr checkAbort;
39
42 bool mergeDocStores;
43
45 static const int32_t MAX_RAW_MERGE_DOCS;
46
47 Collection<SegmentReaderPtr> matchingSegmentReaders;
48 Collection<int32_t> rawDocLengths;
49 Collection<int32_t> rawDocLengths2;
50
51 SegmentMergeQueuePtr queue;
52 bool omitTermFreqAndPositions;
53
54 ByteArray payloadBuffer;
55 Collection< Collection<int32_t> > docMaps;
56 Collection<int32_t> delCounts;
57
58 public:
60 static const uint8_t NORMS_HEADER[];
61 static const int32_t NORMS_HEADER_LENGTH;
62
63 public:
64 bool hasProx();
65
67 void add(IndexReaderPtr reader);
68
71 IndexReaderPtr segmentReader(int32_t i);
72
75 int32_t merge();
76
80 int32_t merge(bool mergeDocStores);
81
83 void closeReaders();
84
85 HashSet<String> getMergedFiles();
86 HashSet<String> createCompoundFile(const String& fileName);
87
89 int32_t mergeFields();
90
91 Collection< Collection<int32_t> > getDocMaps();
92 Collection<int32_t> getDelCounts();
93
94 protected:
95 void addIndexed(IndexReaderPtr reader, FieldInfosPtr fInfos, HashSet<String> names, bool storeTermVectors,
96 bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads,
97 bool omitTFAndPositions);
98
99 void setMatchingSegmentReaders();
100 int32_t copyFieldsWithDeletions(FieldsWriterPtr fieldsWriter, IndexReaderPtr reader, FieldsReaderPtr matchingFieldsReader);
101 int32_t copyFieldsNoDeletions(FieldsWriterPtr fieldsWriter, IndexReaderPtr reader, FieldsReaderPtr matchingFieldsReader);
102
104 void mergeVectors();
105
106 void copyVectorsWithDeletions(TermVectorsWriterPtr termVectorsWriter, TermVectorsReaderPtr matchingVectorsReader, IndexReaderPtr reader);
107 void copyVectorsNoDeletions(TermVectorsWriterPtr termVectorsWriter, TermVectorsReaderPtr matchingVectorsReader, IndexReaderPtr reader);
108
109 void mergeTerms();
110
111 void mergeTermInfos(FormatPostingsFieldsConsumerPtr consumer);
112
118 int32_t appendPostings(FormatPostingsTermsConsumerPtr termsConsumer, Collection<SegmentMergeInfoPtr> smis, int32_t n);
119
120 void mergeNorms();
121 };
122
123 class CheckAbort : public LuceneObject
124 {
125 public:
126 CheckAbort(OneMergePtr merge, DirectoryPtr dir);
127 virtual ~CheckAbort();
128
129 LUCENE_CLASS(CheckAbort);
130
131 protected:
132 double workCount;
133 OneMergePtr merge;
134 DirectoryWeakPtr _dir;
135
136 public:
140 virtual void work(double units);
141 };
142
143 class CheckAbortNull : public CheckAbort
144 {
145 public:
146 CheckAbortNull();
147 virtual ~CheckAbortNull();
148
149 LUCENE_CLASS(CheckAbortNull);
150
151 public:
153 virtual void work(double units);
154 };
155 }
156
157 #endif

clucene.sourceforge.net