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
FieldCacheImpl.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 FIELDCACHEIMPL_H
8
#define FIELDCACHEIMPL_H
9
10
#include "
FieldCache.h
"
11
12
namespace
Lucene {
13
15
class
FieldCacheImpl
:
public
FieldCache
,
public
LuceneObject
{
16
public
:
17
FieldCacheImpl
();
18
virtual
~FieldCacheImpl
();
19
20
LUCENE_CLASS
(
FieldCacheImpl
);
21
22
protected
:
23
MapStringCache
caches
;
24
InfoStreamPtr
infoStream
;
25
26
public
:
27
virtual
void
initialize
();
28
virtual
void
purgeAllCaches
();
29
virtual
void
purge
(
const
IndexReaderPtr
& r);
30
virtual
Collection<FieldCacheEntryPtr>
getCacheEntries
();
31
32
virtual
Collection<uint8_t>
getBytes
(
const
IndexReaderPtr
& reader,
const
String& field);
33
virtual
Collection<uint8_t>
getBytes
(
const
IndexReaderPtr
& reader,
const
String& field,
const
ByteParserPtr
& parser);
34
35
virtual
Collection<int32_t>
getInts
(
const
IndexReaderPtr
& reader,
const
String& field);
36
virtual
Collection<int32_t>
getInts
(
const
IndexReaderPtr
& reader,
const
String& field,
const
IntParserPtr
& parser);
37
38
virtual
Collection<int64_t>
getLongs
(
const
IndexReaderPtr
& reader,
const
String& field);
39
virtual
Collection<int64_t>
getLongs
(
const
IndexReaderPtr
& reader,
const
String& field,
const
LongParserPtr
& parser);
40
41
virtual
Collection<double>
getDoubles
(
const
IndexReaderPtr
& reader,
const
String& field);
42
virtual
Collection<double>
getDoubles
(
const
IndexReaderPtr
& reader,
const
String& field,
const
DoubleParserPtr
& parser);
43
44
virtual
Collection<String>
getStrings
(
const
IndexReaderPtr
& reader,
const
String& field);
45
virtual
StringIndexPtr
getStringIndex
(
const
IndexReaderPtr
& reader,
const
String& field);
46
47
virtual
void
setInfoStream
(
const
InfoStreamPtr
& stream);
48
virtual
InfoStreamPtr
getInfoStream
();
49
};
50
51
class
Entry
:
public
LuceneObject
{
52
public
:
54
Entry
(
const
String&
field
,
const
boost::any&
custom
);
55
virtual
~Entry
();
56
57
LUCENE_CLASS
(
Entry
);
58
59
public
:
60
String
field
;
// which Fieldable
61
boost::any
custom
;
// which custom comparator or parser
62
63
public
:
65
virtual
bool
equals
(
const
LuceneObjectPtr
& other);
66
68
virtual
int32_t
hashCode
();
69
};
70
72
class
Cache
:
public
LuceneObject
{
73
public
:
74
Cache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
75
virtual
~Cache
();
76
77
LUCENE_CLASS
(
Cache
);
78
79
public
:
80
FieldCacheWeakPtr
_wrapper
;
81
WeakMapLuceneObjectMapEntryAny
readerCache
;
82
83
protected
:
84
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key) = 0;
85
86
public
:
88
virtual
void
purge
(
const
IndexReaderPtr
& r);
89
90
virtual
boost::any
get
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
91
virtual
void
printNewInsanity
(
const
InfoStreamPtr
& infoStream,
const
boost::any& value);
92
};
93
94
class
ByteCache
:
public
Cache
{
95
public
:
96
ByteCache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
97
virtual
~ByteCache
();
98
99
LUCENE_CLASS
(
ByteCache
);
100
101
protected
:
102
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
103
};
104
105
class
IntCache
:
public
Cache
{
106
public
:
107
IntCache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
108
virtual
~IntCache
();
109
110
LUCENE_CLASS
(
IntCache
);
111
112
protected
:
113
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
114
};
115
116
class
LongCache
:
public
Cache
{
117
public
:
118
LongCache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
119
virtual
~LongCache
();
120
121
LUCENE_CLASS
(
LongCache
);
122
123
protected
:
124
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
125
};
126
127
class
DoubleCache
:
public
Cache
{
128
public
:
129
DoubleCache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
130
virtual
~DoubleCache
();
131
132
LUCENE_CLASS
(
DoubleCache
);
133
134
protected
:
135
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
136
};
137
138
class
StringCache
:
public
Cache
{
139
public
:
140
StringCache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
141
virtual
~StringCache
();
142
143
LUCENE_CLASS
(
StringCache
);
144
145
protected
:
146
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
147
};
148
149
class
StringIndexCache
:
public
Cache
{
150
public
:
151
StringIndexCache
(
const
FieldCachePtr
& wrapper =
FieldCachePtr
());
152
virtual
~StringIndexCache
();
153
154
LUCENE_CLASS
(
StringIndexCache
);
155
156
protected
:
157
virtual
boost::any
createValue
(
const
IndexReaderPtr
& reader,
const
EntryPtr
& key);
158
};
159
160
class
FieldCacheEntryImpl
:
public
FieldCacheEntry
{
161
public
:
162
FieldCacheEntryImpl
(
const
LuceneObjectPtr
&
readerKey
,
const
String&
fieldName
, int32_t
cacheType
,
const
boost::any&
custom
,
const
boost::any&
value
);
163
virtual
~FieldCacheEntryImpl
();
164
165
LUCENE_CLASS
(
FieldCacheEntryImpl
);
166
167
protected
:
168
LuceneObjectPtr
readerKey
;
169
String
fieldName
;
170
int32_t
cacheType
;
171
boost::any
custom
;
172
boost::any
value
;
173
174
public
:
175
virtual
LuceneObjectPtr
getReaderKey
();
176
virtual
String
getFieldName
();
177
virtual
int32_t
getCacheType
();
178
virtual
boost::any
getCustom
();
179
virtual
boost::any
getValue
();
180
};
181
182
}
183
184
#endif
clucene.sourceforge.net