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


Loading...
Searching...
No Matches
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< FieldCacheImplshared_from_this ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
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.
 
virtual void purge (const 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.
 
virtual Collection< FieldCacheEntryPtrgetCacheEntries ()
 Generates an array of CacheEntry objects representing all items currently in the FieldCache.
 
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 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 ()
 
- Public Member Functions inherited from Lucene::FieldCache
virtual ~FieldCache ()
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

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.
 
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.
 

Protected Attributes

MapStringCache caches
 
InfoStreamPtr infoStream
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

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.
 
- 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

◆ FieldCacheImpl()

Lucene::FieldCacheImpl::FieldCacheImpl ( )

◆ ~FieldCacheImpl()

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

Member Function Documentation

◆ _getClassName()

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

◆ getBytes() [1/2]

virtual Collection< uint8_t > Lucene::FieldCacheImpl::getBytes ( const 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
readerUsed to get field values.
fieldWhich field contains the single byte values.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getBytes() [2/2]

virtual Collection< uint8_t > Lucene::FieldCacheImpl::getBytes ( const IndexReaderPtr reader,
const String &  field,
const 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
readerUsed to get field values.
fieldWhich field contains the bytes.
parserComputes byte for string values.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getCacheEntries()

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

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

Implements Lucene::FieldCache.

◆ getClassName()

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

Reimplemented from Lucene::FieldCache.

◆ getDoubles() [1/2]

virtual Collection< double > Lucene::FieldCacheImpl::getDoubles ( const 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
readerUsed to get field values.
fieldWhich field contains the doubles.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getDoubles() [2/2]

virtual Collection< double > Lucene::FieldCacheImpl::getDoubles ( const IndexReaderPtr reader,
const String &  field,
const 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
readerUsed to get field values.
fieldWhich field contains the doubles.
parserComputes double for string values.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getInfoStream()

virtual InfoStreamPtr Lucene::FieldCacheImpl::getInfoStream ( )
virtual
See also
setInfoStream

Reimplemented from Lucene::FieldCache.

◆ getInts() [1/2]

virtual Collection< int32_t > Lucene::FieldCacheImpl::getInts ( const 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
readerUsed to get field values.
fieldWhich field contains the integers.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getInts() [2/2]

virtual Collection< int32_t > Lucene::FieldCacheImpl::getInts ( const IndexReaderPtr reader,
const String &  field,
const 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
readerUsed to get field values.
fieldWhich field contains the integers.
parserComputes integer for string values.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getLongs() [1/2]

virtual Collection< int64_t > Lucene::FieldCacheImpl::getLongs ( const 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
readerUsed to get field values.
fieldWhich field contains the longs.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getLongs() [2/2]

virtual Collection< int64_t > Lucene::FieldCacheImpl::getLongs ( const IndexReaderPtr reader,
const String &  field,
const 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
readerUsed to get field values.
fieldWhich field contains the longs.
parserComputes long for string values.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ getStringIndex()

virtual StringIndexPtr Lucene::FieldCacheImpl::getStringIndex ( const 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
readerUsed to get field values.
fieldWhich field contains the strings.
Returns
Array of terms and index into the array for each document.

Reimplemented from Lucene::FieldCache.

◆ getStrings()

virtual Collection< String > Lucene::FieldCacheImpl::getStrings ( const 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
readerUsed to get field values.
fieldWhich field contains the strings.
Returns
The values in the given field for each document.

Reimplemented from Lucene::FieldCache.

◆ initialize()

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.

◆ purge()

virtual void Lucene::FieldCacheImpl::purge ( const 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.

◆ purgeAllCaches()

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.

◆ setInfoStream()

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

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

Reimplemented from Lucene::FieldCache.

◆ shared_from_this()

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

Field Documentation

◆ caches

MapStringCache Lucene::FieldCacheImpl::caches
protected

◆ infoStream

InfoStreamPtr Lucene::FieldCacheImpl::infoStream
protected

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

clucene.sourceforge.net