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


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields
Lucene::FieldCacheRangeFilter Class Referenceabstract

A range filter built on top of a cached single term field (in FieldCache). More...

#include <FieldCacheRangeFilter.h>

+ Inheritance diagram for Lucene::FieldCacheRangeFilter:

Public Member Functions

 FieldCacheRangeFilter (const String &field, const ParserPtr &parser, bool includeLower, bool includeUpper)
 
virtual ~FieldCacheRangeFilter ()
 
virtual String getClassName ()
 
boost::shared_ptr< FieldCacheRangeFiltershared_from_this ()
 
virtual String toString ()=0
 Returns a string representation of the object.
 
virtual bool equals (const LuceneObjectPtr &other)=0
 Return whether two objects are equal.
 
virtual int32_t hashCode ()=0
 Return hash code for this object.
 
virtual String getField ()
 Returns the field name for this filter.
 
virtual bool includesLower ()
 Returns true if the lower endpoint is inclusive.
 
virtual bool includesUpper ()
 Returns true if the upper endpoint is inclusive.
 
virtual ParserPtr getParser ()
 Returns the current numeric parser.
 
- Public Member Functions inherited from Lucene::Filter
virtual ~Filter ()
 
boost::shared_ptr< Filtershared_from_this ()
 
virtual DocIdSetPtr getDocIdSet (const IndexReaderPtr &reader)=0
 Creates a DocIdSet enumerating the documents that should be permitted in search results.
 
- 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 FieldCacheRangeFilterPtr newStringRange (const String &field, const String &lowerVal, const String &upperVal, bool includeLower, bool includeUpper)
 Creates a string range filter using FieldCache#getStringIndex. This works with all fields containing zero or one term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newByteRange (const String &field, uint8_t lowerVal, uint8_t upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getBytes(IndexReaderPtr, String). This works with all byte fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newByteRange (const String &field, const ByteParserPtr &parser, uint8_t lowerVal, uint8_t upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getBytes(IndexReaderPtr, String, ByteParserPtr). This works with all byte fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newIntRange (const String &field, int32_t lowerVal, int32_t upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getInts(IndexReaderPtr, String). This works with all int fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newIntRange (const String &field, const IntParserPtr &parser, int32_t lowerVal, int32_t upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getInts(IndexReaderPtr, String, IntParserPtr). This works with all int fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newLongRange (const String &field, int64_t lowerVal, int64_t upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getLongs(IndexReaderPtr, String). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newLongRange (const String &field, const LongParserPtr &parser, int64_t lowerVal, int64_t upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getLongs(IndexReaderPtr, String, LongParserPtr). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newDoubleRange (const String &field, double lowerVal, double upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getDoubles(IndexReaderPtr, String). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
static FieldCacheRangeFilterPtr newDoubleRange (const String &field, const DoubleParserPtr &parser, double lowerVal, double upperVal, bool includeLower, bool includeUpper)
 Creates a numeric range filter using FieldCache#getDoubles(IndexReaderPtr, String, DoubleParserPtr). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.
 
- Static Public Member Functions inherited from Lucene::Filter
static String _getClassName ()
 

Data Fields

INTERNAL : String field
 
ParserPtr parser
 
bool includeLower
 
bool includeUpper
 

Additional Inherited Members

- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Detailed Description

A range filter built on top of a cached single term field (in FieldCache).

FieldCacheRangeFilter builds a single cache for the field the first time it is used. Each subsequent FieldCacheRangeFilter on the same field then reuses this cache, even if the range itself changes.

This means that FieldCacheRangeFilter is much faster (sometimes more than 100x as fast) as building a TermRangeFilter, if using a newStringRange. However, if the range never changes it is slower (around 2x as slow) than building a CachingWrapperFilter on top of a single TermRangeFilter.

For numeric data types, this filter may be significantly faster than NumericRangeFilter. Furthermore, it does not need the numeric values encoded by NumericField. But it has the problem that it only works with exact one value/document (see below).

As with all FieldCache based functionality, FieldCacheRangeFilter is only valid for fields which exact one term for each document (except for newStringRange where 0 terms are also allowed). Due to a restriction of FieldCache, for numeric ranges all terms that do not have a numeric value, 0 is assumed.

Thus it works on dates, prices and other single value fields but will not work on regular text fields. It is preferable to use a NOT_ANALYZED field to ensure that there is only a single term.

Do not instantiate this template directly, use one of the static factory methods available, that create a correct instance for different data types supported by FieldCache.

Constructor & Destructor Documentation

◆ FieldCacheRangeFilter()

Lucene::FieldCacheRangeFilter::FieldCacheRangeFilter ( const String &  field,
const ParserPtr parser,
bool  includeLower,
bool  includeUpper 
)

◆ ~FieldCacheRangeFilter()

virtual Lucene::FieldCacheRangeFilter::~FieldCacheRangeFilter ( )
virtual

Member Function Documentation

◆ _getClassName()

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

◆ equals()

virtual bool Lucene::FieldCacheRangeFilter::equals ( const LuceneObjectPtr other)
pure virtual

Return whether two objects are equal.

Reimplemented from Lucene::LuceneObject.

◆ getClassName()

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

Reimplemented from Lucene::Filter.

◆ getField()

virtual String Lucene::FieldCacheRangeFilter::getField ( )
virtual

Returns the field name for this filter.

◆ getParser()

virtual ParserPtr Lucene::FieldCacheRangeFilter::getParser ( )
virtual

Returns the current numeric parser.

◆ hashCode()

virtual int32_t Lucene::FieldCacheRangeFilter::hashCode ( )
pure virtual

Return hash code for this object.

Reimplemented from Lucene::LuceneObject.

◆ includesLower()

virtual bool Lucene::FieldCacheRangeFilter::includesLower ( )
virtual

Returns true if the lower endpoint is inclusive.

◆ includesUpper()

virtual bool Lucene::FieldCacheRangeFilter::includesUpper ( )
virtual

Returns true if the upper endpoint is inclusive.

◆ newByteRange() [1/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newByteRange ( const String &  field,
const ByteParserPtr parser,
uint8_t  lowerVal,
uint8_t  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getBytes(IndexReaderPtr, String, ByteParserPtr). This works with all byte fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newByteRange() [2/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newByteRange ( const String &  field,
uint8_t  lowerVal,
uint8_t  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getBytes(IndexReaderPtr, String). This works with all byte fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newDoubleRange() [1/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newDoubleRange ( const String &  field,
const DoubleParserPtr parser,
double  lowerVal,
double  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getDoubles(IndexReaderPtr, String, DoubleParserPtr). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newDoubleRange() [2/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newDoubleRange ( const String &  field,
double  lowerVal,
double  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getDoubles(IndexReaderPtr, String). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newIntRange() [1/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newIntRange ( const String &  field,
const IntParserPtr parser,
int32_t  lowerVal,
int32_t  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getInts(IndexReaderPtr, String, IntParserPtr). This works with all int fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newIntRange() [2/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newIntRange ( const String &  field,
int32_t  lowerVal,
int32_t  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getInts(IndexReaderPtr, String). This works with all int fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newLongRange() [1/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newLongRange ( const String &  field,
const LongParserPtr parser,
int64_t  lowerVal,
int64_t  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getLongs(IndexReaderPtr, String, LongParserPtr). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newLongRange() [2/2]

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newLongRange ( const String &  field,
int64_t  lowerVal,
int64_t  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a numeric range filter using FieldCache#getLongs(IndexReaderPtr, String). This works with all long fields containing exactly one numeric term in the field. The range can be half-open by setting one of the values to null.

◆ newStringRange()

static FieldCacheRangeFilterPtr Lucene::FieldCacheRangeFilter::newStringRange ( const String &  field,
const String &  lowerVal,
const String &  upperVal,
bool  includeLower,
bool  includeUpper 
)
static

Creates a string range filter using FieldCache#getStringIndex. This works with all fields containing zero or one term in the field. The range can be half-open by setting one of the values to null.

◆ shared_from_this()

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

◆ toString()

virtual String Lucene::FieldCacheRangeFilter::toString ( )
pure virtual

Returns a string representation of the object.

Reimplemented from Lucene::LuceneObject.

Field Documentation

◆ __pad0__

INTERNAL Lucene::FieldCacheRangeFilter::__pad0__

◆ includeLower

bool Lucene::FieldCacheRangeFilter::includeLower

◆ includeUpper

bool Lucene::FieldCacheRangeFilter::includeUpper

◆ parser

ParserPtr Lucene::FieldCacheRangeFilter::parser

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

clucene.sourceforge.net