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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Attributes
Lucene::FieldCacheImpl Class Reference

The default cache implementation, storing all values in memory. A WeakHashMap is used for storage. More...

`#include <FieldCacheImpl.h>`

Inheritance diagram for Lucene::FieldCacheImpl:

## Public Member Functions

| FieldCacheImpl ()
virtual | ~FieldCacheImpl ()
virtual String | getClassName ()
boost::shared_ptr< FieldCacheImpl > | shared_from_this ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed. More...
virtual void | purgeAllCaches ()
| 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. More...
virtual void | purge (IndexReaderPtr r)
| 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. More...
virtual Collection < FieldCacheEntryPtr > | getCacheEntries ()
| Generates an array of CacheEntry objects representing all items currently in the FieldCache. More...
virtual Collection< uint8_t > | getBytes (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. More...
virtual Collection< uint8_t > | getBytes (IndexReaderPtr reader, const String &field, 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. More...
virtual Collection< int32_t > | getInts (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. More...
virtual Collection< int32_t > | getInts (IndexReaderPtr reader, const String &field, 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. More...
virtual Collection< int64_t > | getLongs (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. More...
virtual Collection< int64_t > | getLongs (IndexReaderPtr reader, const String &field, 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. More...
virtual Collection< double > | getDoubles (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. More...
virtual Collection< double > | getDoubles (IndexReaderPtr reader, const String &field, 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. More...
virtual Collection< String > | getStrings (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. More...
virtual StringIndexPtr | getStringIndex (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. More...
virtual void | setInfoStream (InfoStreamPtr stream)
| If non-null, FieldCacheImpl will warn whenever entries are created that are not sane according to FieldCacheSanityChecker. More...
virtual InfoStreamPtr | getInfoStream ()
Public Member Functions inherited from Lucene::FieldCache
virtual | ~FieldCache ()
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual LuceneObjectPtr | clone (LuceneObjectPtr other=LuceneObjectPtr())
| Return clone of this object. More...
virtual int32_t | hashCode ()
| Return hash code for this object. More...
virtual bool | equals (LuceneObjectPtr other)
| Return whether two objects are equal. More...
virtual int32_t | compareTo (LuceneObjectPtr other)
| Compare two objects. More...
virtual String | toString ()
| Returns a string representation of the object. More...
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock. More...
virtual LuceneSignalPtr | getSignal ()
| Return this object signal. More...
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout. More...
virtual void | unlock ()
| Unlock this object. More...
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread. More...
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout. More...
virtual void | notifyAll ()
| Notify all threads waiting for signal. More...

## Static Public Member Functions

static String | _getClassName ()
Static Public Member Functions inherited from Lucene::FieldCache
static String | _getClassName ()
static FieldCachePtr | DEFAULT ()
| The cache used internally by sorting and range query classes. More...
static ByteParserPtr | DEFAULT_BYTE_PARSER ()
| The default parser for byte values, which are encoded by StringUtils::toInt. More...
static IntParserPtr | DEFAULT_INT_PARSER ()
| The default parser for int values, which are encoded by StringUtils::toInt. More...
static LongParserPtr | DEFAULT_LONG_PARSER ()
| The default parser for int values, which are encoded by StringUtils::toLong. More...
static DoubleParserPtr | DEFAULT_DOUBLE_PARSER ()
| The default parser for double values, which are encoded by StringUtils::toDouble. More...
static IntParserPtr | NUMERIC_UTILS_INT_PARSER ()
| A parser instance for int values encoded by NumericUtils#prefixCodedToInt(String), eg. when indexed via NumericField/NumericTokenStream. More...
static LongParserPtr | NUMERIC_UTILS_LONG_PARSER ()
| A parser instance for long values encoded by NumericUtils#prefixCodedToLong(String), eg. when indexed via NumericField/NumericTokenStream. More...
static DoubleParserPtr | NUMERIC_UTILS_DOUBLE_PARSER ()
| A parser instance for double values encoded by NumericUtils, eg. when indexed via NumericField/NumericTokenStream. More...

## Protected Attributes

MapStringCache | caches
InfoStreamPtr | infoStream

## Additional Inherited Members

Public Types inherited from Lucene::FieldCache
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...
Static Public Attributes inherited from Lucene::FieldCache
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. More...
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Detailed Description

The default cache implementation, storing all values in memory. A WeakHashMap is used for storage.

## Constructor & Destructor Documentation

Lucene::FieldCacheImpl::FieldCacheImpl | ( | ) |  |

virtual Lucene::FieldCacheImpl::~FieldCacheImpl | ( | ) |  |

virtual

## Member Function Documentation

static String Lucene::FieldCacheImpl::_getClassName | ( | ) |  |

inline static

virtual Collection<uint8_t> Lucene::FieldCacheImpl::getBytes | ( | IndexReaderPtr | reader,
|  | const String & | field
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the single byte values.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<uint8_t> Lucene::FieldCacheImpl::getBytes | ( | IndexReaderPtr | reader,
|  | const String & | field,
|  | ByteParserPtr | parser
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the bytes.
  parser | Computes byte for string values.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<FieldCacheEntryPtr> Lucene::FieldCacheImpl::getCacheEntries | ( | ) |  |

virtual

Generates an array of CacheEntry objects representing all items currently in the FieldCache.

Implements Lucene::FieldCache.

virtual String Lucene::FieldCacheImpl::getClassName | ( | ) |  |

inline virtual

Reimplemented from Lucene::FieldCache.

virtual Collection<double> Lucene::FieldCacheImpl::getDoubles | ( | IndexReaderPtr | reader,
|  | const String & | field
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the doubles.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<double> Lucene::FieldCacheImpl::getDoubles | ( | IndexReaderPtr | reader,
|  | const String & | field,
|  | DoubleParserPtr | parser
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the doubles.
  parser | Computes double for string values.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual InfoStreamPtr Lucene::FieldCacheImpl::getInfoStream | ( | ) |  |

virtual

See Also
  setInfoStream

Reimplemented from Lucene::FieldCache.

virtual Collection<int32_t> Lucene::FieldCacheImpl::getInts | ( | IndexReaderPtr | reader,
|  | const String & | field
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the integers.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<int32_t> Lucene::FieldCacheImpl::getInts | ( | IndexReaderPtr | reader,
|  | const String & | field,
|  | IntParserPtr | parser
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the integers.
  parser | Computes integer for string values.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<int64_t> Lucene::FieldCacheImpl::getLongs | ( | IndexReaderPtr | reader,
|  | const String & | field
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the longs.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<int64_t> Lucene::FieldCacheImpl::getLongs | ( | IndexReaderPtr | reader,
|  | const String & | field,
|  | LongParserPtr | parser
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the longs.
  parser | Computes long for string values.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual StringIndexPtr Lucene::FieldCacheImpl::getStringIndex | ( | IndexReaderPtr | reader,
|  | const String & | field
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the strings.

Returns
  Array of terms and index into the array for each document.

Reimplemented from Lucene::FieldCache.

virtual Collection<String> Lucene::FieldCacheImpl::getStrings | ( | IndexReaderPtr | reader,
|  | const String & | field
| ) |  |

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.

Parameters

  reader | Used to get field values.
  field | Which field contains the strings.

Returns
  The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

virtual void Lucene::FieldCacheImpl::initialize | ( | ) |  |

virtual

Called directly after instantiation to create objects that depend on this object being fully constructed.

Reimplemented from Lucene::LuceneObject.

virtual void Lucene::FieldCacheImpl::purge | ( | IndexReaderPtr | r) |  |

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.

Implements Lucene::FieldCache.

virtual void Lucene::FieldCacheImpl::purgeAllCaches | ( | ) |  |

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.

Implements Lucene::FieldCache.

virtual void Lucene::FieldCacheImpl::setInfoStream | ( | InfoStreamPtr | stream) |  |

virtual

If non-null, FieldCacheImpl will warn whenever entries are created that are not sane according to FieldCacheSanityChecker.

Reimplemented from Lucene::FieldCache.

boost::shared_ptr< FieldCacheImpl > Lucene::FieldCacheImpl::shared_from_this | ( | ) |  |

inline

## Field Documentation

MapStringCache Lucene::FieldCacheImpl::caches

protected

InfoStreamPtr Lucene::FieldCacheImpl::infoStream

protected

The documentation for this class was generated from the following file:

- FieldCacheImpl.h

clucene.sourceforge.net