Class TermRangeFilter
A Filter that restricts search results to a range of term values in a given field.
This filter matches the documents looking for terms that fall into the supplied range according to CompareTo(byte), It is not intended for numerical ranges; use NumericRangeFilter instead. If you construct a large number of range filters with different ranges but on the same field, FieldCacheRangeFilter may have significantly better performance. @since 2.9Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class TermRangeFilter : MultiTermQueryWrapperFilter<TermRangeQuery>
Constructors
TermRangeFilter(string, BytesRef, BytesRef, bool, bool)
A Filter that restricts search results to a range of term values in a given field.
This filter matches the documents looking for terms that fall into the supplied range according to CompareTo(byte), It is not intended for numerical ranges; use NumericRangeFilter instead. If you construct a large number of range filters with different ranges but on the same field, FieldCacheRangeFilter may have significantly better performance. @since 2.9Declaration
public TermRangeFilter(string fieldName, BytesRef lowerTerm, BytesRef upperTerm, bool includeLower, bool includeUpper)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | The field this range applies to |
| BytesRef | lowerTerm | The lower bound on this range |
| BytesRef | upperTerm | The upper bound on this range |
| bool | includeLower | Does this range include the lower bound? |
| bool | includeUpper | Does this range include the upper bound? |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | if both terms are |
Properties
IncludesLower
Returns true if the lower endpoint is inclusive
Declaration
public virtual bool IncludesLower { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IncludesUpper
Returns true if the upper endpoint is inclusive
Declaration
public virtual bool IncludesUpper { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LowerTerm
Returns the lower value of this range filter
Declaration
public virtual BytesRef LowerTerm { get; }
Property Value
| Type | Description |
|---|---|
| BytesRef |
UpperTerm
Returns the upper value of this range filter
Declaration
public virtual BytesRef UpperTerm { get; }
Property Value
| Type | Description |
|---|---|
| BytesRef |
Methods
Less(string, BytesRef)
Constructs a filter for field fieldName matching
less than or equal to upperTerm.
Declaration
public static TermRangeFilter Less(string fieldName, BytesRef upperTerm)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | |
| BytesRef | upperTerm |
Returns
| Type | Description |
|---|---|
| TermRangeFilter |
More(string, BytesRef)
Constructs a filter for field fieldName matching
greater than or equal to lowerTerm.
Declaration
public static TermRangeFilter More(string fieldName, BytesRef lowerTerm)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fieldName | |
| BytesRef | lowerTerm |
Returns
| Type | Description |
|---|---|
| TermRangeFilter |
NewStringRange(string, string, string, bool, bool)
Factory that creates a new TermRangeFilter using strings for term text.
Declaration
public static TermRangeFilter NewStringRange(string field, string lowerTerm, string upperTerm, bool includeLower, bool includeUpper)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field | |
| string | lowerTerm | |
| string | upperTerm | |
| bool | includeLower | |
| bool | includeUpper |
Returns
| Type | Description |
|---|---|
| TermRangeFilter |