Class FieldCacheRangeFilter
A range filter built on top of a cached single term field (in IFieldCache).
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(string, string, string, bool, bool).
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
Int32Field,
SingleField,
Int64Field or
DoubleField. But
it has the problem that it only works with exact one value/document (see below).
As with all
IFieldCache based functionality,
FieldCacheRangeFilter is only valid for
fields which exact one term for each document (except for
NewStringRange(string, string, string, bool, bool)
where 0 terms are also allowed). Due to a restriction of
IFieldCache, 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.
This class does not have an constructor, use one of the static factory methods available,
that create a correct instance for different data types supported by
IFieldCache.
Inheritance
FieldCacheRangeFilter
Assembly: Lucene.Net.dll
Syntax
public static class FieldCacheRangeFilter
Methods
NewByteRange(string, IByteParser, sbyte?, sbyte?, bool, bool)
Declaration
[Obsolete]
[CLSCompliant(false)]
public static FieldCacheRangeFilter<sbyte?> NewByteRange(string field, FieldCache.IByteParser parser, sbyte? lowerVal, sbyte? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewByteRange(string, sbyte?, sbyte?, bool, bool)
Creates a numeric range filter using GetBytes(AtomicReader, string, bool). 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
.
Declaration
[Obsolete]
[CLSCompliant(false)]
public static FieldCacheRangeFilter<sbyte?> NewByteRange(string field, sbyte? lowerVal, sbyte? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewBytesRefRange(string, BytesRef, BytesRef, bool, bool)
Declaration
public static FieldCacheRangeFilter<BytesRef> NewBytesRefRange(string field, BytesRef lowerVal, BytesRef upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewDoubleRange(string, IDoubleParser, double?, double?, bool, bool)
Declaration
public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, FieldCache.IDoubleParser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewDoubleRange(string, double?, double?, bool, bool)
Creates a numeric range filter using GetDoubles(AtomicReader, string, bool). This works with all
double fields containing exactly one numeric term in the field. The range can be half-open by setting one
of the values to null
.
Declaration
public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewInt16Range(string, IInt16Parser, short?, short?, bool, bool)
Declaration
[Obsolete]
public static FieldCacheRangeFilter<short?> NewInt16Range(string field, FieldCache.IInt16Parser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewInt16Range(string, short?, short?, bool, bool)
Creates a numeric range filter using GetInt16s(AtomicReader, string, bool). This works with all
short fields containing exactly one numeric term in the field. The range can be half-open by setting one
of the values to null
.
NOTE: this was newShortRange() in Lucene
Declaration
[Obsolete]
public static FieldCacheRangeFilter<short?> NewInt16Range(string field, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewInt32Range(string, IInt32Parser, int?, int?, bool, bool)
Creates a numeric range filter using GetInt32s(AtomicReader, string, IInt32Parser, bool). 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
.
NOTE: this was newIntRange() in Lucene
Declaration
public static FieldCacheRangeFilter<int?> NewInt32Range(string field, FieldCache.IInt32Parser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewInt32Range(string, int?, int?, bool, bool)
Creates a numeric range filter using GetInt32s(AtomicReader, string, bool). 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
.
NOTE: this was newIntRange() in Lucene
Declaration
public static FieldCacheRangeFilter<int?> NewInt32Range(string field, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewInt64Range(string, IInt64Parser, long?, long?, bool, bool)
Creates a numeric range filter using GetInt64s(AtomicReader, string, IInt64Parser, bool). 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
.
NOTE: this was newLongRange() in Lucene
Declaration
public static FieldCacheRangeFilter<long?> NewInt64Range(string field, FieldCache.IInt64Parser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewInt64Range(string, long?, long?, bool, bool)
Creates a numeric range filter using GetInt64s(AtomicReader, string, bool). 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
.
Declaration
public static FieldCacheRangeFilter<long?> NewInt64Range(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewSingleRange(string, ISingleParser, float?, float?, bool, bool)
Declaration
public static FieldCacheRangeFilter<float?> NewSingleRange(string field, FieldCache.ISingleParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewSingleRange(string, float?, float?, bool, bool)
Creates a numeric range filter using GetSingles(AtomicReader, string, bool). This works with all
float fields containing exactly one numeric term in the field. The range can be half-open by setting one
of the values to null
.
NOTE: this was newFloatRange() in Lucene
Declaration
public static FieldCacheRangeFilter<float?> NewSingleRange(string field, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
Parameters
Returns
NewStringRange(string, string, string, bool, bool)
Creates a string range filter using GetTermsIndex(AtomicReader, string, float). 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
.
Declaration
public static FieldCacheRangeFilter<string> NewStringRange(string field, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
Parameters
Returns