Lucene++ - a full-featured, c++ search engine
API Documentation
Maintains caches of term values. More...
#include <FieldCache.h>
Public Types | |
enum | CacheType { CACHE_BYTE = 1 , CACHE_INT , CACHE_LONG , CACHE_DOUBLE , CACHE_STRING , CACHE_STRING_INDEX } |
Specifies whether and how a field should be stored. More... | |
Public Member Functions | |
virtual | ~FieldCache () |
virtual String | getClassName () |
virtual Collection< uint8_t > | getBytes (const IndexReaderPtr &reader, const String &field) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as a single byte and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< uint8_t > | getBytes (const IndexReaderPtr &reader, const String &field, const ByteParserPtr &parser) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as bytes and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< int32_t > | getInts (const IndexReaderPtr &reader, const String &field) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< int32_t > | getInts (const IndexReaderPtr &reader, const String &field, const IntParserPtr &parser) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< int64_t > | getLongs (const IndexReaderPtr &reader, const String &field) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as longs and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< int64_t > | getLongs (const IndexReaderPtr &reader, const String &field, const LongParserPtr &parser) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as longs and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< double > | getDoubles (const IndexReaderPtr &reader, const String &field) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< double > | getDoubles (const IndexReaderPtr &reader, const String &field, const DoubleParserPtr &parser) |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as doubles and returns an array of size reader.maxDoc() of the value each document has in the given field. | |
virtual Collection< String > | getStrings (const IndexReaderPtr &reader, const String &field) |
Checks the internal cache for an appropriate entry, and if none are found, reads the term values in field and returns an array of size reader.maxDoc() containing the value each document has in the given field. | |
virtual StringIndexPtr | getStringIndex (const IndexReaderPtr &reader, const String &field) |
Checks the internal cache for an appropriate entry, and if none are found reads the term values in field and returns an array of them in natural order, along with an array telling which element in the term array each document uses. | |
virtual Collection< FieldCacheEntryPtr > | getCacheEntries ()=0 |
Generates an array of CacheEntry objects representing all items currently in the FieldCache. | |
virtual void | purgeAllCaches ()=0 |
Instructs the FieldCache to forcibly expunge all entries from the underlying caches. This is intended only to be used for test methods as a way to ensure a known base state of the Cache. It should not be relied on for "Cache maintenance" in general application code. | |
virtual void | purge (const IndexReaderPtr &r)=0 |
Drops all cache entries associated with this reader. NOTE: this reader must precisely match the reader that the cache entry is keyed on. If you pass a top-level reader, it usually will have no effect as Lucene now caches at the segment reader level. | |
virtual void | setInfoStream (const InfoStreamPtr &stream) |
If non-null, FieldCacheImpl will warn whenever entries are created that are not sane according to FieldCacheSanityChecker . | |
virtual InfoStreamPtr | getInfoStream () |
Static Public Member Functions | |
static String | _getClassName () |
static FieldCachePtr | DEFAULT () |
The cache used internally by sorting and range query classes. | |
static ByteParserPtr | DEFAULT_BYTE_PARSER () |
The default parser for byte values, which are encoded by StringUtils::toInt. | |
static IntParserPtr | DEFAULT_INT_PARSER () |
The default parser for int values, which are encoded by StringUtils::toInt. | |
static LongParserPtr | DEFAULT_LONG_PARSER () |
The default parser for int values, which are encoded by StringUtils::toLong. | |
static DoubleParserPtr | DEFAULT_DOUBLE_PARSER () |
The default parser for double values, which are encoded by StringUtils::toDouble. | |
static IntParserPtr | NUMERIC_UTILS_INT_PARSER () |
A parser instance for int values encoded by NumericUtils#prefixCodedToInt(String) , eg. when indexed via NumericField /NumericTokenStream . | |
static LongParserPtr | NUMERIC_UTILS_LONG_PARSER () |
A parser instance for long values encoded by NumericUtils#prefixCodedToLong(String) , eg. when indexed via NumericField /NumericTokenStream . | |
static DoubleParserPtr | NUMERIC_UTILS_DOUBLE_PARSER () |
A parser instance for double values encoded by NumericUtils , eg. when indexed via NumericField /NumericTokenStream . | |
Static Public Attributes | |
static const int32_t | STRING_INDEX |
Indicator for StringIndex values in the cache. NOTE: the value assigned to this constant must not be the same as any of those in SortField. | |
Maintains caches of term values.
|
virtual |
|
inlinestatic |
|
static |
The cache used internally by sorting and range query classes.
|
static |
The default parser for byte values, which are encoded by StringUtils::toInt.
|
static |
The default parser for double values, which are encoded by StringUtils::toDouble.
|
static |
The default parser for int values, which are encoded by StringUtils::toInt.
|
static |
The default parser for int values, which are encoded by StringUtils::toLong.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as a single byte and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the single byte values. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as bytes and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the bytes. |
parser | Computes byte for string values. |
Reimplemented in Lucene::FieldCacheImpl.
|
pure virtual |
Generates an array of CacheEntry objects representing all items currently in the FieldCache.
Implemented in Lucene::FieldCacheImpl.
|
inlinevirtual |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the doubles. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as doubles and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the doubles. |
parser | Computes double for string values. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the integers. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as integers and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the integers. |
parser | Computes integer for string values. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as longs and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the longs. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the terms in field as longs and returns an array of size reader.maxDoc() of the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the longs. |
parser | Computes long for string values. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found reads the term values in field and returns an array of them in natural order, along with an array telling which element in the term array each document uses.
reader | Used to get field values. |
field | Which field contains the strings. |
Reimplemented in Lucene::FieldCacheImpl.
|
virtual |
Checks the internal cache for an appropriate entry, and if none are found, reads the term values in field and returns an array of size reader.maxDoc() containing the value each document has in the given field.
reader | Used to get field values. |
field | Which field contains the strings. |
Reimplemented in Lucene::FieldCacheImpl.
|
static |
A parser instance for double values encoded by NumericUtils
, eg. when indexed via NumericField
/NumericTokenStream
.
|
static |
A parser instance for int values encoded by NumericUtils#prefixCodedToInt(String)
, eg. when indexed via NumericField
/NumericTokenStream
.
|
static |
A parser instance for long values encoded by NumericUtils#prefixCodedToLong(String)
, eg. when indexed via NumericField
/NumericTokenStream
.
|
pure virtual |
Drops all cache entries associated with this reader. NOTE: this reader must precisely match the reader that the cache entry is keyed on. If you pass a top-level reader, it usually will have no effect as Lucene now caches at the segment reader level.
Implemented in Lucene::FieldCacheImpl.
|
pure virtual |
Instructs the FieldCache to forcibly expunge all entries from the underlying caches. This is intended only to be used for test methods as a way to ensure a known base state of the Cache. It should not be relied on for "Cache maintenance" in general application code.
Implemented in Lucene::FieldCacheImpl.
|
virtual |
If non-null, FieldCacheImpl will warn whenever entries are created that are not sane according to FieldCacheSanityChecker
.
Reimplemented in Lucene::FieldCacheImpl.
|
static |
Indicator for StringIndex values in the cache. NOTE: the value assigned to this constant must not be the same as any of those in SortField.