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 // 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 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  {
19  public:
20  virtual ~FieldCache();
22 
23  public:
25  enum CacheType
26  {
27  CACHE_BYTE = 1,
32  CACHE_STRING_INDEX
33  };
34 
37  static const int32_t STRING_INDEX;
38 
39  public:
41  static FieldCachePtr DEFAULT();
42 
44  static ByteParserPtr DEFAULT_BYTE_PARSER();
45 
47  static IntParserPtr DEFAULT_INT_PARSER();
48 
50  static LongParserPtr DEFAULT_LONG_PARSER();
51 
53  static DoubleParserPtr DEFAULT_DOUBLE_PARSER();
54 
57  static IntParserPtr NUMERIC_UTILS_INT_PARSER();
58 
61  static LongParserPtr NUMERIC_UTILS_LONG_PARSER();
62 
65  static DoubleParserPtr NUMERIC_UTILS_DOUBLE_PARSER();
66 
73  virtual Collection<uint8_t> getBytes(IndexReaderPtr reader, const String& field);
74 
82  virtual Collection<uint8_t> getBytes(IndexReaderPtr reader, const String& field, ByteParserPtr parser);
83 
90  virtual Collection<int32_t> getInts(IndexReaderPtr reader, const String& field);
91 
99  virtual Collection<int32_t> getInts(IndexReaderPtr reader, const String& field, IntParserPtr parser);
100 
107  virtual Collection<int64_t> getLongs(IndexReaderPtr reader, const String& field);
108 
116  virtual Collection<int64_t> getLongs(IndexReaderPtr reader, const String& field, LongParserPtr parser);
117 
124  virtual Collection<double> getDoubles(IndexReaderPtr reader, const String& field);
125 
133  virtual Collection<double> getDoubles(IndexReaderPtr reader, const String& field, DoubleParserPtr parser);
134 
141  virtual Collection<String> getStrings(IndexReaderPtr reader, const String& field);
142 
149  virtual StringIndexPtr getStringIndex(IndexReaderPtr reader, const String& field);
150 
152  virtual Collection<FieldCacheEntryPtr> getCacheEntries() = 0;
153 
157  virtual void purgeAllCaches() = 0;
158 
162  virtual void purge(IndexReaderPtr r) = 0;
163 
166  virtual void setInfoStream(InfoStreamPtr stream);
167 
169  virtual InfoStreamPtr getInfoStream();
170  };
171 
172  class LPPAPI CreationPlaceholder : public LuceneObject
173  {
174  public:
175  virtual ~CreationPlaceholder();
177 
178  public:
179  boost::any value;
180  };
181 
183  class LPPAPI StringIndex : public LuceneObject
184  {
185  public:
187  virtual ~StringIndex();
188 
190 
191  public:
193  Collection<String> lookup;
194 
197 
198  public:
199  int32_t binarySearchLookup(const String& key);
200  };
201 
204  class LPPAPI Parser : public LuceneObject
205  {
206  public:
207  virtual ~Parser();
209  };
210 
213  class LPPAPI ByteParser : public Parser
214  {
215  public:
216  virtual ~ByteParser();
218 
219  public:
221  virtual uint8_t parseByte(const String& string);
222  };
223 
226  class LPPAPI IntParser : public Parser
227  {
228  public:
229  virtual ~IntParser();
231 
232  public:
234  virtual int32_t parseInt(const String& string);
235  };
236 
239  class LPPAPI LongParser : public Parser
240  {
241  public:
242  virtual ~LongParser();
244 
245  public:
247  virtual int64_t parseLong(const String& string);
248  };
249 
252  class LPPAPI DoubleParser : public Parser
253  {
254  public:
255  virtual ~DoubleParser();
257 
258  public:
260  virtual double parseDouble(const String& string);
261  };
262 
264  class LPPAPI FieldCacheEntry : public LuceneObject
265  {
266  public:
267  virtual ~FieldCacheEntry();
269 
270  public:
271  virtual LuceneObjectPtr getReaderKey() = 0;
272  virtual String getFieldName() = 0;
273  virtual int32_t getCacheType() = 0;
274  virtual boost::any getCustom() = 0;
275  virtual boost::any getValue() = 0;
276 
277  virtual String toString();
278  };
279 }
280 
281 #endif

clucene.sourceforge.net