Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FieldCache.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 FIELDCACHE_H
8 #define FIELDCACHE_H
9 
10 #include <boost/any.hpp>
11 #include "LuceneObject.h"
12 
13 namespace Lucene {
14 
17 class LPPAPI FieldCache {
18 public:
19  virtual ~FieldCache();
21 
22 public:
24  enum CacheType {
25  CACHE_BYTE = 1,
30  CACHE_STRING_INDEX
31  };
32 
35  static const int32_t STRING_INDEX;
36 
37 public:
39  static FieldCachePtr DEFAULT();
40 
42  static ByteParserPtr DEFAULT_BYTE_PARSER();
43 
45  static IntParserPtr DEFAULT_INT_PARSER();
46 
48  static LongParserPtr DEFAULT_LONG_PARSER();
49 
51  static DoubleParserPtr DEFAULT_DOUBLE_PARSER();
52 
55  static IntParserPtr NUMERIC_UTILS_INT_PARSER();
56 
59  static LongParserPtr NUMERIC_UTILS_LONG_PARSER();
60 
63  static DoubleParserPtr NUMERIC_UTILS_DOUBLE_PARSER();
64 
71  virtual Collection<uint8_t> getBytes(const IndexReaderPtr& reader, const String& field);
72 
80  virtual Collection<uint8_t> getBytes(const IndexReaderPtr& reader, const String& field, const ByteParserPtr& parser);
81 
88  virtual Collection<int32_t> getInts(const IndexReaderPtr& reader, const String& field);
89 
97  virtual Collection<int32_t> getInts(const IndexReaderPtr& reader, const String& field, const IntParserPtr& parser);
98 
105  virtual Collection<int64_t> getLongs(const IndexReaderPtr& reader, const String& field);
106 
114  virtual Collection<int64_t> getLongs(const IndexReaderPtr& reader, const String& field, const LongParserPtr& parser);
115 
122  virtual Collection<double> getDoubles(const IndexReaderPtr& reader, const String& field);
123 
131  virtual Collection<double> getDoubles(const IndexReaderPtr& reader, const String& field, const DoubleParserPtr& parser);
132 
139  virtual Collection<String> getStrings(const IndexReaderPtr& reader, const String& field);
140 
147  virtual StringIndexPtr getStringIndex(const IndexReaderPtr& reader, const String& field);
148 
150  virtual Collection<FieldCacheEntryPtr> getCacheEntries() = 0;
151 
155  virtual void purgeAllCaches() = 0;
156 
160  virtual void purge(const IndexReaderPtr& r) = 0;
161 
164  virtual void setInfoStream(const InfoStreamPtr& stream);
165 
167  virtual InfoStreamPtr getInfoStream();
168 };
169 
170 class LPPAPI CreationPlaceholder : public LuceneObject {
171 public:
172  virtual ~CreationPlaceholder();
174 
175 public:
176  boost::any value;
177 };
178 
180 class LPPAPI StringIndex : public LuceneObject {
181 public:
183  virtual ~StringIndex();
184 
186 
187 public:
189  Collection<String> lookup;
190 
193 
194 public:
195  int32_t binarySearchLookup(const String& key);
196 };
197 
200 class LPPAPI Parser : public LuceneObject {
201 public:
202  virtual ~Parser();
204 };
205 
208 class LPPAPI ByteParser : public Parser {
209 public:
210  virtual ~ByteParser();
212 
213 public:
215  virtual uint8_t parseByte(const String& string);
216 };
217 
220 class LPPAPI IntParser : public Parser {
221 public:
222  virtual ~IntParser();
224 
225 public:
227  virtual int32_t parseInt(const String& string);
228 };
229 
232 class LPPAPI LongParser : public Parser {
233 public:
234  virtual ~LongParser();
236 
237 public:
239  virtual int64_t parseLong(const String& string);
240 };
241 
244 class LPPAPI DoubleParser : public Parser {
245 public:
246  virtual ~DoubleParser();
248 
249 public:
251  virtual double parseDouble(const String& string);
252 };
253 
255 class LPPAPI FieldCacheEntry : public LuceneObject {
256 public:
257  virtual ~FieldCacheEntry();
259 
260 public:
261  virtual LuceneObjectPtr getReaderKey() = 0;
262  virtual String getFieldName() = 0;
263  virtual int32_t getCacheType() = 0;
264  virtual boost::any getCustom() = 0;
265  virtual boost::any getValue() = 0;
266 
267  virtual String toString();
268 };
269 
270 }
271 
272 #endif

clucene.sourceforge.net