redis-om / WhereField
Abstract base class that all fields you want to filter with extend. When you call where, a subclass of this is returned.
Name | Type |
---|---|
T |
extends Entity = Record <string , any > |
-
↳
WhereField
- after
- before
- between
- contain
- containOneOf
- contains
- containsOneOf
- eq
- equal
- equalTo
- equals
- false
- greaterThan
- greaterThanOrEqualTo
- gt
- gte
- inCircle
- inRadius
- lessThan
- lessThanOrEqualTo
- lt
- lte
- match
- matchExact
- matchExactly
- matches
- matchesExactly
- on
- onOrAfter
- onOrBefore
- toString
- true
• Readonly
exact: WhereField
<T
>
Makes a call to match a matchExact call. Calling this multiple times will have no effect.
• Readonly
exactly: WhereField
<T
>
Makes a call to match a matchExact call. Calling this multiple times will have no effect.
• get
does(): this
Returns the current instance. Syntactic sugar to make your code more fluent.
this
this
• get
is(): this
Returns the current instance. Syntactic sugar to make your code more fluent.
this
this
• get
not(): this
Negates the query on the field, cause it to match when the condition is not met. Calling this multiple times will negate the negation.
this
this
▸ after(value
): Search
<T
>
Add a search that matches all datetimes after the provided UTC datetime to the query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The datetime to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ before(value
): Search
<T
>
Add a search that matches all datetimes before the provided UTC datetime to the query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The datetime to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ between(lower
, upper
): Search
<T
>
Adds an inclusive range comparison against a field to the search query.
Name | Type | Description |
---|---|---|
lower |
string | number | Date |
The lower bound of the range. |
upper |
string | number | Date |
The upper bound of the range. |
Search
<T
>
The Search that was called to create this WhereField.
▸ contain(value
): Search
<T
>
Adds a whole-string match for a value within a string array to the search query.
Name | Type | Description |
---|---|---|
value |
string |
The string to be matched. |
Search
<T
>
The Search that was called to create this WhereField.
▸ containOneOf(...value
): Search
<T
>
Adds a whole-string match against a string array to the query. If any of the provided
strings in value
is matched in the array, this matched.
Name | Type | Description |
---|---|---|
...value |
string [] |
An array of strings that you want to match one of. |
Search
<T
>
The Search that was called to create this WhereField.
▸ contains(value
): Search
<T
>
Adds a whole-string match for a value within a string array to the search query.
Name | Type | Description |
---|---|---|
value |
string |
The string to be matched. |
Search
<T
>
The Search that was called to create this WhereField.
▸ containsOneOf(...value
): Search
<T
>
Adds a whole-string match against a string array to the query. If any of the provided
strings in value
is matched in the array, this matched.
Name | Type | Description |
---|---|---|
...value |
string [] |
An array of strings that you want to match one of. |
Search
<T
>
The Search that was called to create this WhereField.
▸ eq(value
): Search
<T
>
Adds an equals comparison to the query.
NOTE: this function is not available for strings where full-text
search is enabled. In that scenario, use .match
.
Name | Type | Description |
---|---|---|
value |
string | number | boolean | Date |
The value to be compared |
Search
<T
>
The Search that was called to create this WhereField.
▸ equal(value
): Search
<T
>
Adds an equals comparison to the query.
NOTE: this function is not available for strings where full-text
search is enabled. In that scenario, use .match
.
Name | Type | Description |
---|---|---|
value |
string | number | boolean | Date |
The value to be compared |
Search
<T
>
The Search that was called to create this WhereField.
▸ equalTo(value
): Search
<T
>
Adds an equals comparison to the query.
NOTE: this function is not available for strings where full-text
search is enabled. In that scenario, use .match
.
Name | Type | Description |
---|---|---|
value |
string | number | boolean | Date |
The value to be compared |
Search
<T
>
The Search that was called to create this WhereField.
▸ equals(value
): Search
<T
>
Adds an equals comparison to the query.
NOTE: this function is not available for strings where full-text
search is enabled. In that scenario, use .match
.
Name | Type | Description |
---|---|---|
value |
string | number | boolean | Date |
The value to be compared |
Search
<T
>
The Search that was called to create this WhereField.
▸ false(): Search
<T
>
Adds a boolean match with a value of false
to the query.
Search
<T
>
The Search that was called to create this WhereField.
▸ greaterThan(value
): Search
<T
>
Adds a greater than comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ greaterThanOrEqualTo(value
): Search
<T
>
Adds a greater than or equal to comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ gt(value
): Search
<T
>
Adds a greater than comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ gte(value
): Search
<T
>
Adds a greater than or equal to comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ inCircle(circleFn
): Search
<T
>
Adds a search for points that fall within a defined circle.
Name | Type | Description |
---|---|---|
circleFn |
CircleFunction |
A function that returns a Circle instance defining the search area. |
Search
<T
>
The Search that was called to create this WhereField.
▸ inRadius(circleFn
): Search
<T
>
Adds a search for points that fall within a defined radius.
Name | Type | Description |
---|---|---|
circleFn |
CircleFunction |
A function that returns a Circle instance defining the search area. |
Search
<T
>
The Search that was called to create this WhereField.
▸ lessThan(value
): Search
<T
>
Adds a less than comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ lessThanOrEqualTo(value
): Search
<T
>
Adds a less than or equal to comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ lt(value
): Search
<T
>
Adds a less than comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ lte(value
): Search
<T
>
Adds a less than or equal to comparison against a field to the search query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The value to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ match(value
, options?
): Search
<T
>
Adds a full-text search comparison to the query.
Name | Type | Description |
---|---|---|
value |
string | number | boolean |
The word or phrase sought. |
options? |
Object |
|
options.fuzzyMatching? |
boolean |
Whether to use fuzzy matching to find the sought word or phrase. Defaults to false . |
options.levenshteinDistance? |
2 | 1 | 3 |
The levenshtein distance to use for fuzzy matching. Supported values are 1 , 2 , and 3 . Defaults to 1 . |
Search
<T
>
The Search that was called to create this WhereField.
▸ matchExact(value
): Search
<T
>
Adds a full-text search comparison to the query that matches an exact word or phrase.
Name | Type | Description |
---|---|---|
value |
string | number | boolean |
The word or phrase sought. |
Search
<T
>
The Search that was called to create this WhereField.
▸ matchExactly(value
): Search
<T
>
Adds a full-text search comparison to the query that matches an exact word or phrase.
Name | Type | Description |
---|---|---|
value |
string | number | boolean |
The word or phrase sought. |
Search
<T
>
The Search that was called to create this WhereField.
▸ matches(value
, options?
): Search
<T
>
Adds a full-text search comparison to the query.
Name | Type | Description |
---|---|---|
value |
string | number | boolean |
The word or phrase sought. |
options? |
Object |
|
options.fuzzyMatching? |
boolean |
Whether to use fuzzy matching to find the sought word or phrase. Defaults to false . |
options.levenshteinDistance? |
2 | 1 | 3 |
The levenshtein distance to use for fuzzy matching. Supported values are 1 , 2 , and 3 . Defaults to 1 . |
Search
<T
>
The Search that was called to create this WhereField.
▸ matchesExactly(value
): Search
<T
>
Adds a full-text search comparison to the query that matches an exact word or phrase.
Name | Type | Description |
---|---|---|
value |
string | number | boolean |
The word or phrase sought. |
Search
<T
>
The Search that was called to create this WhereField.
▸ on(value
): Search
<T
>
Add a search for an exact UTC datetime to the query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The datetime to match. |
Search
<T
>
The Search that was called to create this WhereField.
▸ onOrAfter(value
): Search
<T
>
Add a search that matches all datetimes on or after the provided UTC datetime to the query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The datetime to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ onOrBefore(value
): Search
<T
>
Add a search that matches all datetimes on or before the provided UTC datetime to the query.
Name | Type | Description |
---|---|---|
value |
string | number | Date |
The datetime to compare against. |
Search
<T
>
The Search that was called to create this WhereField.
▸ Abstract
toString(): string
Converts this Where into a portion of a RediSearch query.
string
▸ true(): Search
<T
>
Adds a boolean match with a value of true
to the query.
Search
<T
>
The Search that was called to create this WhereField.