Lucene++ - a full-featured, c++ search engine
API Documentation
A range filter built on top of a cached single term field (in FieldCache
).
More...
#include <FieldCacheRangeFilter.h>
Public Member Functions | |
FieldCacheRangeFilter (const String &field, const ParserPtr &parser, bool includeLower, bool includeUpper) | |
virtual | ~FieldCacheRangeFilter () |
virtual String | getClassName () |
boost::shared_ptr< FieldCacheRangeFilter > | shared_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. | |
![]() | |
virtual | ~Filter () |
boost::shared_ptr< Filter > | shared_from_this () |
virtual DocIdSetPtr | getDocIdSet (const IndexReaderPtr &reader)=0 |
Creates a DocIdSet enumerating the documents that should be permitted in search results. | |
![]() | |
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. | |
![]() | |
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 String | _getClassName () |
Data Fields | |
INTERNAL | : String field |
ParserPtr | parser |
bool | includeLower |
bool | includeUpper |
Additional Inherited Members | |
![]() | |
LuceneObject () | |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
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
.
Lucene::FieldCacheRangeFilter::FieldCacheRangeFilter | ( | const String & | field, |
const ParserPtr & | parser, | ||
bool | includeLower, | ||
bool | includeUpper | ||
) |
|
virtual |
|
inlinestatic |
|
pure virtual |
Return whether two objects are equal.
Reimplemented from Lucene::LuceneObject.
|
inlinevirtual |
Reimplemented from Lucene::Filter.
|
virtual |
Returns the field name for this filter.
|
virtual |
Returns the current numeric parser.
|
pure virtual |
Return hash code for this object.
Reimplemented from Lucene::LuceneObject.
|
virtual |
Returns true if the lower endpoint is inclusive.
|
virtual |
Returns true if the upper endpoint is inclusive.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
inline |
|
pure virtual |
Returns a string representation of the object.
Reimplemented from Lucene::LuceneObject.
INTERNAL Lucene::FieldCacheRangeFilter::__pad0__ |
bool Lucene::FieldCacheRangeFilter::includeLower |
bool Lucene::FieldCacheRangeFilter::includeUpper |
ParserPtr Lucene::FieldCacheRangeFilter::parser |