Numeric filter for range and exact matching on numeric fields.
Numeric fields in Redis support range queries and exact matching on numerical values.
They use interval notation where square brackets [ ] indicate inclusive bounds
and parentheses ( indicate exclusive bounds.
Numeric fields must be indexed with the NUMERIC type in the metadata schema.
class NumericFilterDiscriminator property for type-safe filter identification. Each filter type has a unique filterType value.
Combine this filter with another using AND logic.
In RediSearch, AND operations are represented by space-separated conditions
within parentheses: (condition1 condition2)
Combine this filter with another using OR logic.
In RediSearch, OR operations are represented by pipe-separated conditions
within parentheses: (condition1|condition2)
Converts the filter expression to a RediSearch query string.
Creates a builder object for constructing numeric filters.
// Exact match
const filter = new NumericFilter("price", "eq", 99.99);
// Generates: @price:[99.99 99.99]
// Greater than (exclusive)
const filter = new NumericFilter("price", "gt", 50);
// Generates: @price:[(50 +inf]
// Less than or equal (inclusive)
const filter = new NumericFilter("price", "lte", 100);
// Generates: @price:[-inf 100]
// Range (inclusive on both ends)
const filter = new NumericFilter("price", "between", [50, 200]);
// Generates: @price:[50 200]
// Using convenience methods
const filter = Num("price").between(50, 200);
const filter2 = Num("rating").gte(4.5);