Class TermRangeQuery
A Query that matches documents within an range of terms.
This query 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 NumericRangeQuery instead.
This query uses the CONSTANT_SCORE_AUTO_REWRITE_DEFAULT rewrite method.
@since 2.9
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class TermRangeQuery : MultiTermQuery
Constructors
| Improve this Doc View SourceTermRangeQuery(String, BytesRef, BytesRef, Boolean, Boolean)
Constructs a query selecting all terms greater/equal than lowerTerm
but less/equal than upperTerm.
If an endpoint is null, it is said
to be "open". Either or both endpoints may be open. Open endpoints may not
be exclusive (you can't select all but the first or last term without
explicitly specifying the term to exclude.)
Declaration
public TermRangeQuery(string field, BytesRef lowerTerm, BytesRef upperTerm, bool includeLower, bool includeUpper)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | field | The field that holds both lower and upper terms. |
| BytesRef | lowerTerm | The term text at the lower end of the range. |
| BytesRef | upperTerm | The term text at the upper end of the range. |
| System.Boolean | includeLower | If true, the |
| System.Boolean | includeUpper | If true, the |
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 query
Declaration
public virtual BytesRef LowerTerm { get; }
Property Value
| Type | Description |
|---|---|
| BytesRef |
UpperTerm
Returns the upper value of this range query
Declaration
public virtual BytesRef UpperTerm { get; }
Property Value
| Type | Description |
|---|---|
| BytesRef |
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
| Improve this Doc View SourceGetTermsEnum(Terms, AttributeSource)
Declaration
protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
Parameters
| Type | Name | Description |
|---|---|---|
| Terms | terms | |
| AttributeSource | atts |
Returns
| Type | Description |
|---|---|
| TermsEnum |
Overrides
| Improve this Doc View SourceNewStringRange(String, String, String, Boolean, Boolean)
Factory that creates a new TermRangeQuery using System.Strings for term text.
Declaration
public static TermRangeQuery 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 |
|---|---|
| TermRangeQuery |
ToString(String)
Prints a user-readable version of this query.
Declaration
public override string ToString(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | field |
Returns
| Type | Description |
|---|---|
| System.String |