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

clucene.sourceforge.net