Skip to content

Latest commit

 

History

History
921 lines (517 loc) · 21.9 KB

WhereField.md

File metadata and controls

921 lines (517 loc) · 21.9 KB

redis-om / WhereField

Class: WhereField<T>

Abstract base class that all fields you want to filter with extend. When you call where, a subclass of this is returned.

Type parameters

Name Type
T extends Entity = Record<string, any>

Hierarchy

Table of contents

Properties

Accessors

Methods

Properties

exact

Readonly exact: WhereField<T>

Makes a call to match a matchExact call. Calling this multiple times will have no effect.

Defined in

lib/search/where-field.ts:99


exactly

Readonly exactly: WhereField<T>

Makes a call to match a matchExact call. Calling this multiple times will have no effect.

Defined in

lib/search/where-field.ts:106

Accessors

does

get does(): this

Returns the current instance. Syntactic sugar to make your code more fluent.

Returns

this

this

Defined in

lib/search/where-field.ts:296


is

get is(): this

Returns the current instance. Syntactic sugar to make your code more fluent.

Returns

this

this

Defined in

lib/search/where-field.ts:288


not

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.

Returns

this

this

Defined in

lib/search/where-field.ts:305

Methods

after

after(value): Search<T>

Add a search that matches all datetimes after the provided UTC datetime to the query.

Parameters

Name Type Description
value string | number | Date The datetime to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:247


before

before(value): Search<T>

Add a search that matches all datetimes before the provided UTC datetime to the query.

Parameters

Name Type Description
value string | number | Date The datetime to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:240


between

between(lower, upper): Search<T>

Adds an inclusive range comparison against a field to the search query.

Parameters

Name Type Description
lower string | number | Date The lower bound of the range.
upper string | number | Date The upper bound of the range.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:182


contain

contain(value): Search<T>

Adds a whole-string match for a value within a string array to the search query.

Parameters

Name Type Description
value string The string to be matched.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:189


containOneOf

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.

Parameters

Name Type Description
...value string[] An array of strings that you want to match one of.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:204


contains

contains(value): Search<T>

Adds a whole-string match for a value within a string array to the search query.

Parameters

Name Type Description
value string The string to be matched.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:196


containsOneOf

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.

Parameters

Name Type Description
...value string[] An array of strings that you want to match one of.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:212


eq

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.

Parameters

Name Type Description
value string | number | boolean | Date The value to be compared

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:21


equal

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.

Parameters

Name Type Description
value string | number | boolean | Date The value to be compared

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:31


equalTo

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.

Parameters

Name Type Description
value string | number | boolean | Date The value to be compared

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:51


equals

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.

Parameters

Name Type Description
value string | number | boolean | Date The value to be compared

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:41


false

false(): Search<T>

Adds a boolean match with a value of false to the query.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:118


greaterThan

greaterThan(value): Search<T>

Adds a greater than comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:132


greaterThanOrEqualTo

greaterThanOrEqualTo(value): Search<T>

Adds a greater than or equal to comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:146


gt

gt(value): Search<T>

Adds a greater than comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:125


gte

gte(value): Search<T>

Adds a greater than or equal to comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:139


inCircle

inCircle(circleFn): Search<T>

Adds a search for points that fall within a defined circle.

Parameters

Name Type Description
circleFn CircleFunction A function that returns a Circle instance defining the search area.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:219


inRadius

inRadius(circleFn): Search<T>

Adds a search for points that fall within a defined radius.

Parameters

Name Type Description
circleFn CircleFunction A function that returns a Circle instance defining the search area.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:226


lessThan

lessThan(value): Search<T>

Adds a less than comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:160


lessThanOrEqualTo

lessThanOrEqualTo(value): Search<T>

Adds a less than or equal to comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:174


lt

lt(value): Search<T>

Adds a less than comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:153


lte

lte(value): Search<T>

Adds a less than or equal to comparison against a field to the search query.

Parameters

Name Type Description
value string | number | Date The value to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:167


match

match(value, options?): Search<T>

Adds a full-text search comparison to the query.

Parameters

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.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:61


matchExact

matchExact(value): Search<T>

Adds a full-text search comparison to the query that matches an exact word or phrase.

Parameters

Name Type Description
value string | number | boolean The word or phrase sought.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:78


matchExactly

matchExactly(value): Search<T>

Adds a full-text search comparison to the query that matches an exact word or phrase.

Parameters

Name Type Description
value string | number | boolean The word or phrase sought.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:85


matches

matches(value, options?): Search<T>

Adds a full-text search comparison to the query.

Parameters

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.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:71


matchesExactly

matchesExactly(value): Search<T>

Adds a full-text search comparison to the query that matches an exact word or phrase.

Parameters

Name Type Description
value string | number | boolean The word or phrase sought.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:92


on

on(value): Search<T>

Add a search for an exact UTC datetime to the query.

Parameters

Name Type Description
value string | number | Date The datetime to match.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:233


onOrAfter

onOrAfter(value): Search<T>

Add a search that matches all datetimes on or after the provided UTC datetime to the query.

Parameters

Name Type Description
value string | number | Date The datetime to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:261


onOrBefore

onOrBefore(value): Search<T>

Add a search that matches all datetimes on or before the provided UTC datetime to the query.

Parameters

Name Type Description
value string | number | Date The datetime to compare against.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:254


toString

Abstract toString(): string

Converts this Where into a portion of a RediSearch query.

Returns

string

Inherited from

Where.toString

Defined in

lib/search/where-field.ts:310


true

true(): Search<T>

Adds a boolean match with a value of true to the query.

Returns

Search<T>

The Search that was called to create this WhereField.

Defined in

lib/search/where-field.ts:112