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
include
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
26
LUCENE_CLASS
(
SegmentMerger
);
27
28
protected
:
29
DirectoryPtr
directory
;
30
String
segment
;
31
int32_t
termIndexInterval
;
32
33
Collection<IndexReaderPtr>
readers
;
34
FieldInfosPtr
fieldInfos
;
35
36
int32_t
mergedDocs
;
37
CheckAbortPtr
checkAbort
;
38
41
bool
mergeDocStores
;
42
44
static
const
int32_t
MAX_RAW_MERGE_DOCS
;
45
46
Collection<SegmentReaderPtr>
matchingSegmentReaders
;
47
Collection<int32_t>
rawDocLengths
;
48
Collection<int32_t>
rawDocLengths2
;
49
50
SegmentMergeQueuePtr
queue
;
51
bool
omitTermFreqAndPositions
;
52
53
ByteArray
payloadBuffer
;
54
Collection< Collection<int32_t>
>
docMaps
;
55
Collection<int32_t>
delCounts
;
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
84
HashSet<String>
getMergedFiles
();
85
HashSet<String>
createCompoundFile
(
const
String& fileName);
86
88
int32_t
mergeFields
();
89
90
Collection< Collection<int32_t>
>
getDocMaps
();
91
Collection<int32_t>
getDelCounts
();
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
98
void
setMatchingSegmentReaders
();
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
127
LUCENE_CLASS
(
CheckAbort
);
128
129
protected
:
130
double
workCount
;
131
OneMergePtr
merge
;
132
DirectoryWeakPtr
_dir
;
133
134
public
:
138
virtual
void
work
(
double
units);
139
};
140
141
class
CheckAbortNull
:
public
CheckAbort
{
142
public
:
143
CheckAbortNull
();
144
virtual
~CheckAbortNull
();
145
146
LUCENE_CLASS
(
CheckAbortNull
);
147
148
public
:
150
virtual
void
work
(
double
units);
151
};
152
153
}
154
155
#endif
clucene.sourceforge.net