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
TermVectorsTermsWriter.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 TERMVECTORSTERMSWRITER_H
8
#define TERMVECTORSTERMSWRITER_H
9
10
#include "
TermsHashConsumer.h
"
11
#include "
DocumentsWriter.h
"
12
#include "
RawPostingList.h
"
13
14
namespace
Lucene
15
{
16
class
TermVectorsTermsWriter
:
public
TermsHashConsumer
17
{
18
public
:
19
TermVectorsTermsWriter
(
DocumentsWriterPtr
docWriter);
20
virtual
~TermVectorsTermsWriter
();
21
22
LUCENE_CLASS
(
TermVectorsTermsWriter
);
23
24
public
:
25
DocumentsWriterWeakPtr
_docWriter
;
26
TermVectorsWriterPtr
termVectorsWriter
;
27
Collection<TermVectorsTermsWriterPerDocPtr>
docFreeList
;
28
int32_t
freeCount
;
29
IndexOutputPtr
tvx
;
30
IndexOutputPtr
tvd
;
31
IndexOutputPtr
tvf
;
32
int32_t
lastDocID
;
33
int32_t
allocCount
;
34
35
public
:
36
virtual
TermsHashConsumerPerThreadPtr
addThread
(
TermsHashPerThreadPtr
perThread);
37
virtual
void
createPostings
(
Collection<RawPostingListPtr>
postings, int32_t start, int32_t count);
38
virtual
void
flush
(MapTermsHashConsumerPerThreadCollectionTermsHashConsumerPerField threadsAndFields,
SegmentWriteStatePtr
state);
39
virtual
void
closeDocStore
(
SegmentWriteStatePtr
state);
40
41
TermVectorsTermsWriterPerDocPtr
getPerDoc
();
42
44
void
fill
(int32_t docID);
45
46
void
initTermVectorsWriter
();
47
void
finishDocument
(
TermVectorsTermsWriterPerDocPtr
perDoc);
48
bool
freeRAM
();
49
void
free
(
TermVectorsTermsWriterPerDocPtr
doc);
50
51
virtual
void
abort
();
52
virtual
int32_t
bytesPerPosting
();
53
};
54
55
class
TermVectorsTermsWriterPerDoc
:
public
DocWriter
56
{
57
public
:
58
TermVectorsTermsWriterPerDoc
(
TermVectorsTermsWriterPtr
termsWriter =
TermVectorsTermsWriterPtr
());
59
virtual
~TermVectorsTermsWriterPerDoc
();
60
61
LUCENE_CLASS
(
TermVectorsTermsWriterPerDoc
);
62
63
protected
:
64
TermVectorsTermsWriterWeakPtr
_termsWriter
;
65
66
public
:
67
PerDocBufferPtr
buffer
;
68
RAMOutputStreamPtr
perDocTvf
;
69
int32_t
numVectorFields
;
70
71
Collection<int32_t>
fieldNumbers
;
72
Collection<int64_t>
fieldPointers
;
73
74
public
:
75
void
reset
();
76
virtual
void
abort
();
77
void
addField
(int32_t fieldNumber);
78
virtual
int64_t
sizeInBytes
();
79
virtual
void
finish
();
80
};
81
82
class
TermVectorsTermsWriterPostingList
:
public
RawPostingList
83
{
84
public
:
85
TermVectorsTermsWriterPostingList
();
86
virtual
~TermVectorsTermsWriterPostingList
();
87
88
LUCENE_CLASS
(
TermVectorsTermsWriterPostingList
);
89
90
public
:
91
int32_t
freq
;
// How many times this term occurred in the current doc
92
int32_t
lastOffset
;
// Last offset we saw
93
int32_t
lastPosition
;
// Last position where this term occurred
94
};
95
}
96
97
#endif
clucene.sourceforge.net