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


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes
Lucene::FieldCacheSource Class Referenceabstract

A base class for ValueSource implementations that retrieve values for a single field from the FieldCache. More...

#include <FieldCacheSource.h>

+ Inheritance diagram for Lucene::FieldCacheSource:

Public Member Functions

 FieldCacheSource (const String &field)
 Create a cached field source for the input field.
 
virtual ~FieldCacheSource ()
 
virtual String getClassName ()
 
boost::shared_ptr< FieldCacheSourceshared_from_this ()
 
virtual DocValuesPtr getValues (const IndexReaderPtr &reader)
 Return the DocValues used by the function query.
 
virtual String description ()
 Description of field, used in explain()
 
virtual DocValuesPtr getCachedFieldValues (const FieldCachePtr &cache, const String &field, const IndexReaderPtr &reader)=0
 Return cached DocValues for input field and reader.
 
virtual bool equals (const LuceneObjectPtr &other)
 Needed for possible caching of query results - used by ValueSourceQuery#equals(LuceneObjectPtr).
 
virtual int32_t hashCode ()
 Needed for possible caching of query results - used by ValueSourceQuery#hashCode().
 
virtual bool cachedFieldSourceEquals (const FieldCacheSourcePtr &other)=0
 Check if equals to another FieldCacheSource, already knowing that cache and field are equal.
 
virtual int32_t cachedFieldSourceHashCode ()=0
 Return a hash code of a FieldCacheSource, without the hash-codes of the field and the cache (those are taken care of elsewhere).
 
- Public Member Functions inherited from Lucene::ValueSource
virtual ~ValueSource ()
 
boost::shared_ptr< ValueSourceshared_from_this ()
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
- 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::ValueSource
static String _getClassName ()
 

Protected Attributes

String field
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Additional Inherited Members

- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Detailed Description

A base class for ValueSource implementations that retrieve values for a single field from the FieldCache.

Fields used herein must be indexed (doesn't matter if these fields are stored or not).

It is assumed that each such indexed field is untokenized, or at least has a single token in a document. For documents with multiple tokens of the same field, behavior is undefined (It is likely that current code would use the value of one of these tokens, but this is not guaranteed).

Document with no tokens in this field are assigned the Zero value.

NOTE: with the switch in 2.9 to segment-based searching, if getValues is invoked with a composite (multi-segment) reader, this can easily cause double RAM usage for the values in the FieldCache. It's best to switch your application to pass only atomic (single segment) readers to this API.

Constructor & Destructor Documentation

◆ FieldCacheSource()

Lucene::FieldCacheSource::FieldCacheSource ( const String &  field)

Create a cached field source for the input field.

◆ ~FieldCacheSource()

virtual Lucene::FieldCacheSource::~FieldCacheSource ( )
virtual

Member Function Documentation

◆ _getClassName()

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

◆ cachedFieldSourceEquals()

virtual bool Lucene::FieldCacheSource::cachedFieldSourceEquals ( const FieldCacheSourcePtr other)
pure virtual

Check if equals to another FieldCacheSource, already knowing that cache and field are equal.

Implemented in Lucene::ByteFieldSource, Lucene::DoubleFieldSource, and Lucene::IntFieldSource.

◆ cachedFieldSourceHashCode()

virtual int32_t Lucene::FieldCacheSource::cachedFieldSourceHashCode ( )
pure virtual

Return a hash code of a FieldCacheSource, without the hash-codes of the field and the cache (those are taken care of elsewhere).

Implemented in Lucene::ByteFieldSource, Lucene::DoubleFieldSource, and Lucene::IntFieldSource.

◆ description()

virtual String Lucene::FieldCacheSource::description ( )
virtual

Description of field, used in explain()

Implements Lucene::ValueSource.

Reimplemented in Lucene::ByteFieldSource, Lucene::DoubleFieldSource, and Lucene::IntFieldSource.

◆ equals()

virtual bool Lucene::FieldCacheSource::equals ( const LuceneObjectPtr other)
virtual

Needed for possible caching of query results - used by ValueSourceQuery#equals(LuceneObjectPtr).

Implements Lucene::ValueSource.

◆ getCachedFieldValues()

virtual DocValuesPtr Lucene::FieldCacheSource::getCachedFieldValues ( const FieldCachePtr cache,
const String &  field,
const IndexReaderPtr reader 
)
pure virtual

Return cached DocValues for input field and reader.

Parameters
cacheFieldCache so that values of a field are loaded once per reader (RAM allowing)
fieldField for which values are required.
See also
ValueSource

Implemented in Lucene::ByteFieldSource, Lucene::DoubleFieldSource, and Lucene::IntFieldSource.

◆ getClassName()

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

◆ getValues()

virtual DocValuesPtr Lucene::FieldCacheSource::getValues ( const IndexReaderPtr reader)
virtual

Return the DocValues used by the function query.

Parameters
readerThe IndexReader used to read these values. If any caching is involved, that caching would also be IndexReader based.

Implements Lucene::ValueSource.

◆ hashCode()

virtual int32_t Lucene::FieldCacheSource::hashCode ( )
virtual

Needed for possible caching of query results - used by ValueSourceQuery#hashCode().

Implements Lucene::ValueSource.

◆ shared_from_this()

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

Field Documentation

◆ field

String Lucene::FieldCacheSource::field
protected

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

clucene.sourceforge.net