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 System.Byte.CompareTo(System.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.9
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class TermRangeFilter : MultiTermQueryWrapperFilter<TermRangeQuery>
Constructors
| Improve this Doc View SourceTermRangeFilter(String, BytesRef, BytesRef, Boolean, Boolean)
Declaration
public TermRangeFilter(string fieldName, BytesRef lowerTerm, BytesRef upperTerm, bool includeLower, bool includeUpper)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | The field this range applies to |
BytesRef | lowerTerm | The lower bound on this range |
BytesRef | upperTerm | The upper bound on this range |
System.Boolean | includeLower | Does this range include the lower bound? |
System.Boolean | includeUpper | Does this range include the upper bound? |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | if both terms are |
Properties
| Improve this Doc View SourceIncludesLower
Returns true
if the lower endpoint is inclusive
Declaration
public virtual bool IncludesLower { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IncludesUpper
Returns true
if the upper endpoint is inclusive
Declaration
public virtual bool IncludesUpper { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
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
| Improve this Doc View SourceLess(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 |
---|---|---|
System.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 |
---|---|---|
System.String | fieldName | |
BytesRef | lowerTerm |
Returns
Type | Description |
---|---|
TermRangeFilter |
NewStringRange(String, String, String, Boolean, Boolean)
Factory that creates a new TermRangeFilter using System.Strings for term text.
Declaration
public static TermRangeFilter NewStringRange(string field, string lowerTerm, string upperTerm, bool includeLower, bool includeUpper)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | |
System.String | lowerTerm | |
System.String | upperTerm | |
System.Boolean | includeLower | |
System.Boolean | includeUpper |
Returns
Type | Description |
---|---|
TermRangeFilter |