Table of Contents

Method Range

Namespace
TantivyDotNet
Assembly
TantivyDotNet.dll

Range(string, long?, long?, bool, bool)

Matches documents whose field value lies between the bounds. A null bound is open; at least one must be set. The field must be indexed or fast (fast is quicker).

public static RangeQuery Range(string field, long? lower, long? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string

An integer or f64 field.

lower long?

Lower bound, or null for none.

upper long?

Upper bound, or null for none.

includeLower bool

Whether lower itself matches.

includeUpper bool

Whether upper itself matches. Both default to inclusive, like [a TO b].

Returns

RangeQuery

Range(string, ulong?, ulong?, bool, bool)

Matches documents whose field value lies between the bounds. A null bound is open; at least one must be set. The field must be indexed or fast (fast is quicker).

public static RangeQuery Range(string field, ulong? lower, ulong? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string

An integer or f64 field.

lower ulong?

Lower bound, or null for none.

upper ulong?

Upper bound, or null for none.

includeLower bool

Whether lower itself matches.

includeUpper bool

Whether upper itself matches. Both default to inclusive, like [a TO b].

Returns

RangeQuery

Range(string, double?, double?, bool, bool)

Matches documents whose field value lies between the bounds. A null bound is open; at least one must be set. The field must be indexed or fast (fast is quicker).

public static RangeQuery Range(string field, double? lower, double? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string

An integer or f64 field.

lower double?

Lower bound, or null for none.

upper double?

Upper bound, or null for none.

includeLower bool

Whether lower itself matches.

includeUpper bool

Whether upper itself matches. Both default to inclusive, like [a TO b].

Returns

RangeQuery

Range(string, DateTimeOffset?, DateTimeOffset?, bool, bool)

Matches documents whose field value lies between the bounds. A null bound is open; at least one must be set. The field must be indexed or fast (fast is quicker).

public static RangeQuery Range(string field, DateTimeOffset? lower, DateTimeOffset? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string

An integer or f64 field.

lower DateTimeOffset?

Lower bound, or null for none.

upper DateTimeOffset?

Upper bound, or null for none.

includeLower bool

Whether lower itself matches.

includeUpper bool

Whether upper itself matches. Both default to inclusive, like [a TO b].

Returns

RangeQuery

Remarks

Dates are compared at the index's date precision (seconds by default).

Range(string, DateTime?, DateTime?, bool, bool)

Matches documents whose field value lies between the bounds. A null bound is open; at least one must be set. The field must be indexed or fast (fast is quicker).

public static RangeQuery Range(string field, DateTime? lower, DateTime? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string

An integer or f64 field.

lower DateTime?

Lower bound, or null for none.

upper DateTime?

Upper bound, or null for none.

includeLower bool

Whether lower itself matches.

includeUpper bool

Whether upper itself matches. Both default to inclusive, like [a TO b].

Returns

RangeQuery

Remarks

A Unspecified value is treated as UTC.

Range(string, IPAddress?, IPAddress?, bool, bool)

Matches documents whose field value lies between the bounds. A null bound is open; at least one must be set. The field must be indexed or fast (fast is quicker).

public static RangeQuery Range(string field, IPAddress? lower, IPAddress? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string

An integer or f64 field.

lower IPAddress

Lower bound, or null for none.

upper IPAddress

Upper bound, or null for none.

includeLower bool

Whether lower itself matches.

includeUpper bool

Whether upper itself matches. Both default to inclusive, like [a TO b].

Returns

RangeQuery

Remarks

For an IP address field. IPv4 bounds compare as IPv4-mapped IPv6, so an IPv4 range doesn't include IPv6 addresses.

Range(string, string?, string?, bool, bool)

Matches terms of a text field that sort between the bounds (ordinal, byte-wise). Mostly useful on string fields. A null bound is open.

public static RangeQuery Range(string field, string? lower, string? upper, bool includeLower = true, bool includeUpper = true)

Parameters

field string
lower string
upper string
includeLower bool

Whether lower itself matches.

includeUpper bool

Returns

RangeQuery