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
TermVectorsReader.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 TERMVECTORSREADER_H
8
#define TERMVECTORSREADER_H
9
10
#include "
TermVectorMapper.h
"
11
12
namespace
Lucene {
13
14
class
TermVectorsReader
:
public
LuceneObject
{
15
public
:
16
TermVectorsReader
();
17
TermVectorsReader
(
const
DirectoryPtr
& d,
const
String& segment,
const
FieldInfosPtr
&
fieldInfos
);
18
TermVectorsReader
(
const
DirectoryPtr
& d,
const
String& segment,
const
FieldInfosPtr
& fieldInfos,
19
int32_t readBufferSize, int32_t
docStoreOffset
= -1, int32_t
size
= 0);
20
virtual
~TermVectorsReader
();
21
22
LUCENE_CLASS
(
TermVectorsReader
);
23
24
public
:
26
static
const
int32_t
FORMAT_VERSION
;
27
29
static
const
int32_t
FORMAT_VERSION2
;
30
32
static
const
int32_t
FORMAT_UTF8_LENGTH_IN_BYTES
;
33
35
static
const
int32_t
FORMAT_CURRENT
;
36
38
static
const
int32_t
FORMAT_SIZE
;
39
40
static
const
uint8_t
STORE_POSITIONS_WITH_TERMVECTOR
;
41
static
const
uint8_t
STORE_OFFSET_WITH_TERMVECTOR
;
42
43
protected
:
44
FieldInfosPtr
fieldInfos
;
45
46
IndexInputPtr
tvx
;
47
IndexInputPtr
tvd
;
48
IndexInputPtr
tvf
;
49
int32_t
_size
;
50
int32_t
numTotalDocs
;
51
53
int32_t
docStoreOffset
;
54
55
int32_t
format
;
56
57
public
:
59
IndexInputPtr
getTvdStream
();
60
62
IndexInputPtr
getTvfStream
();
63
64
bool
canReadRawDocs
();
65
69
void
rawDocs
(
Collection<int32_t>
tvdLengths,
Collection<int32_t>
tvfLengths, int32_t startDocID, int32_t numDocs);
70
71
void
close
();
72
74
int32_t
size
();
75
76
void
get
(int32_t docNum,
const
String& field,
const
TermVectorMapperPtr
& mapper);
77
83
TermFreqVectorPtr
get
(int32_t docNum,
const
String& field);
84
89
Collection<TermFreqVectorPtr>
get
(int32_t docNum);
90
91
void
get
(int32_t docNumber,
const
TermVectorMapperPtr
& mapper);
92
93
virtual
LuceneObjectPtr
clone
(
const
LuceneObjectPtr
& other =
LuceneObjectPtr
());
94
95
protected
:
96
void
ConstructReader
(
const
DirectoryPtr
& d,
const
String& segment,
const
FieldInfosPtr
& fieldInfos, int32_t readBufferSize, int32_t
docStoreOffset
, int32_t
size
);
97
98
void
seekTvx
(int32_t docNum);
99
100
int32_t
checkValidFormat
(
const
IndexInputPtr
& in);
101
103
Collection<String>
readFields
(int32_t fieldCount);
104
106
Collection<int64_t>
readTvfPointers
(int32_t fieldCount);
107
108
Collection<TermFreqVectorPtr>
readTermVectors
(int32_t docNum,
Collection<String>
fields,
Collection<int64_t>
tvfPointers);
109
void
readTermVectors
(
Collection<String>
fields,
Collection<int64_t>
tvfPointers,
const
TermVectorMapperPtr
& mapper);
110
114
void
readTermVector
(
const
String& field, int64_t tvfPointer,
const
TermVectorMapperPtr
& mapper);
115
};
116
118
class
ParallelArrayTermVectorMapper
:
public
TermVectorMapper
{
119
public
:
120
ParallelArrayTermVectorMapper
();
121
virtual
~ParallelArrayTermVectorMapper
();
122
123
LUCENE_CLASS
(
ParallelArrayTermVectorMapper
);
124
125
protected
:
126
Collection<String>
terms
;
127
Collection<int32_t>
termFreqs
;
128
Collection< Collection<int32_t>
>
positions
;
129
Collection< Collection<TermVectorOffsetInfoPtr>
>
offsets
;
130
int32_t
currentPosition
;
131
bool
storingOffsets
;
132
bool
storingPositions
;
133
String
field
;
134
135
public
:
138
virtual
void
setExpectations
(
const
String&
field
, int32_t numTerms,
bool
storeOffsets,
bool
storePositions);
139
141
virtual
void
map
(
const
String& term, int32_t frequency,
Collection<TermVectorOffsetInfoPtr>
offsets
,
Collection<int32_t>
positions
);
142
145
TermFreqVectorPtr
materializeVector
();
146
};
147
148
}
149
150
#endif
clucene.sourceforge.net