redis-om

July 15, 2024 · View on GitHub

redis-om

redis-om

Table of contents

Classes

Type Aliases

Variables

Type Aliases

AllFieldDefinition

Ƭ AllFieldDefinition: Object

All configuration properties that any field might have, regardless of type.

Type declaration

NameTypeDescription
alias?stringThe default field name in Redis is the property name defined in the SchemaDefinition. Overrides the field name for a Hash to this value or in the case of JSON documents, sets the JSONPath to this value preceded by $.. Overridden by field and/or path settings. Deprecated
caseSensitive?booleanIs the original case of this field indexed with Redis OM. Defaults to false.
field?stringThe field name used to store this in a Redis Hash. Defaults to the name used in the SchemaDefinition or the alias property.
indexed?booleanIs this field indexed and thus searchable with Redis OM. Defaults to true.
matcher?"dm:en" | "dm:fr" | "dm:pt" | "dm:es"Enables setting the phonetic matcher to use, supported matchers are: dm:en - Double Metaphone for English dm:fr - Double Metaphone for French dm:pt - Double Metaphone for Portuguese dm:es - Double Metaphone for Spanish
normalized?booleanIs this (sortable) field normalized when indexed. Defaults to true.
path?stringThe JSONPath expression this field references. Used only by search and only for JSON documents. Defaults to the name used in the SchemaDefinition or the alias property prefixed with $. .
separator?stringDue to how RediSearch works, strings and arrays are sometimes stored the same in Redis, as a simple string. This is the separator used to split those strings when it is an array. If your StringField contains this separator, this can cause problems. You can change it here to avoid those problems. Defaults to |.
sortable?booleanEnables sorting by this field.
stemming?booleanIs word stemming applied to this field with Redis OM. Defaults to true.
typeFieldTypeThe type of the field (i.e. string, number, boolean, etc.)
weight?numberEnables setting the weight to apply to a text field

Defined in

lib/schema/definitions.ts:7


BooleanFieldDefinition

Ƭ BooleanFieldDefinition: { type: "boolean" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable">

A field representing a boolean.

Defined in

lib/schema/definitions.ts:80


CircleFunction

Ƭ CircleFunction: (circle: Circle) => Circle

Type declaration

▸ (circle): Circle

A function that defines a circle for .inCircle searches.

Parameters
NameType
circleCircle
Returns

Circle

Defined in

lib/search/where-point.ts:8


CommonFieldDefinition

Ƭ CommonFieldDefinition: Pick<AllFieldDefinition, "type" | "alias" | "indexed" | "field" | "path">

The configuration properties that all fields have in common.

Defined in

lib/schema/definitions.ts:77


DataStructure

Ƭ DataStructure: "HASH" | "JSON"

The type of data structure in Redis to map objects to.

Defined in

lib/schema/options.ts:2


DateFieldDefinition

Ƭ DateFieldDefinition: { type: "date" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable">

A field representing a date/time.

Defined in

lib/schema/definitions.ts:85


Entity

Ƭ Entity: EntityData & EntityInternal

Defines the objects returned from calls to repositories.

Defined in

lib/entity/entity.ts:16


EntityData

Ƭ EntityData: Object

The free-form data associated with an Entity.

Index signature

▪ [key: string]: EntityDataValue | EntityData | (EntityDataValue | EntityData)[]

Defined in

lib/entity/entity.ts:20


EntityDataValue

Ƭ EntityDataValue: string | number | boolean | Date | Point | null | undefined | (EntityDataValue | EntityData)[]

Valid types for values in an Entity.

Defined in

lib/entity/entity.ts:25


EntityInternal

Ƭ EntityInternal: Object

Type declaration

NameTypeDescription
[EntityId]?stringThe unique ID of the Entity. Access using the EntityId Symbol.
[EntityKeyName]?stringThe key the Entity is stored under inside of Redis. Access using the EntityKeyName Symbol.

Defined in

lib/entity/entity.ts:7


EntityKeys

Ƭ EntityKeys<T>: Exclude<keyof T, keyof EntityInternal>

Type parameters

NameType
Textends Entity

Defined in

lib/entity/entity.ts:17


FieldDefinition

Ƭ FieldDefinition: BooleanFieldDefinition | DateFieldDefinition | NumberFieldDefinition | NumberArrayFieldDefinition | PointFieldDefinition | StringFieldDefinition | StringArrayFieldDefinition | TextFieldDefinition

Contains instructions telling how to map a property on an Entity to Redis.

Defined in

lib/schema/definitions.ts:119


FieldType

Ƭ FieldType: "boolean" | "date" | "number" | "number[]" | "point" | "string" | "string[]" | "text"

Valid field types for a FieldDefinition.

Defined in

lib/schema/definitions.ts:4


IdStrategy

Ƭ IdStrategy: () => Promise<string>

Type declaration

▸ (): Promise<string>

A function that generates random entityIds.

Returns

Promise<string>

Defined in

lib/schema/options.ts:5


InferSchema

Ƭ InferSchema<T>: T extends Schema<infer R> ? R : never

Type parameters

Name
T

Defined in

lib/schema/schema.ts:181


NumberArrayFieldDefinition

Ƭ NumberArrayFieldDefinition: { type: "number[]" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable">

A field representing an array of numbers.

Defined in

lib/schema/definitions.ts:95


NumberFieldDefinition

Ƭ NumberFieldDefinition: { type: "number" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable">

A field representing a number.

Defined in

lib/schema/definitions.ts:90


Point

Ƭ Point: Object

Defines a point on the globe using longitude and latitude.

Type declaration

NameTypeDescription
latitudenumberThe latitude of the point.
longitudenumberThe longitude of the point.

Defined in

lib/entity/entity.ts:28


PointFieldDefinition

Ƭ PointFieldDefinition: { type: "point" } & CommonFieldDefinition

A field representing a point on the globe.

Defined in

lib/schema/definitions.ts:100


RedisClientConnection

Ƭ RedisClientConnection: ReturnType<typeof createClient>

A conventional Redis connection.

Defined in

lib/client/client.ts:8


RedisClusterConnection

Ƭ RedisClusterConnection: ReturnType<typeof createCluster>

A clustered Redis connection.

Defined in

lib/client/client.ts:11


RedisConnection

Ƭ RedisConnection: RedisClientConnection | RedisClusterConnection

A Redis connection, clustered or conventional.

Defined in

lib/client/client.ts:14


SchemaDefinition

Ƭ SchemaDefinition<T>: Record<EntityKeys<T>, FieldDefinition>

Group of FieldDefinitions that define the schema for an Entity.

Type parameters

NameType
Textends Entity = Record<string, any>

Defined in

lib/schema/definitions.ts:125


SchemaOptions

Ƭ SchemaOptions: Object

Configuration options for a Schema.

Type declaration

NameTypeDescription
dataStructure?DataStructureThe data structure used to store the Entity in Redis. Can be set to either JSON or HASH. Defaults to JSON.
idStrategy?IdStrategyA function that generates a random entityId. Defaults to a function that generates ULIDs. Combined with prefix to generate a Redis key. If prefix is Foo and idStratgey returns 12345 then the generated key would be Foo:12345.
indexHashName?stringThe name used by Redis OM to store the hash of the index for this Schema. Defaults to prefix followed by :index:hash. So, for a prefix of Foo, it would use Foo:index:hash.
indexName?stringThe name used by RediSearch to store the index for this Schema. Defaults to prefix followed by :index. So, for a prefix of Foo, it would use Foo:index.
stopWords?string[]Stop words to be used by this schema. If useStopWords is anything other than CUSTOM, this option is ignored.
useStopWords?StopWordOptionsConfigures the usage of stop words. Valid values are OFF, DEFAULT, and CUSTOM. Setting this to OFF disables all stop words. Setting this to DEFAULT uses the stop words intrinsic to RediSearch. Setting this to CUSTOM tells RediSearch to use the stop words in stopWords.

Defined in

lib/schema/options.ts:11


StopWordOptions

Ƭ StopWordOptions: "OFF" | "DEFAULT" | "CUSTOM"

Valid values for how to use stop words for a given Schema.

Defined in

lib/schema/options.ts:8


StringArrayFieldDefinition

Ƭ StringArrayFieldDefinition: { type: "string[]" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable" | "caseSensitive" | "normalized" | "separator">

A field representing an array of strings.

Defined in

lib/schema/definitions.ts:109


StringFieldDefinition

Ƭ StringFieldDefinition: { type: "string" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable" | "caseSensitive" | "normalized" | "separator">

A field representing a whole string.

Defined in

lib/schema/definitions.ts:104


SubSearchFunction

Ƭ SubSearchFunction<T>: (search: Search<T>) => Search<T>

Type parameters

NameType
Textends Entity

Type declaration

▸ (search): Search<T>

A function that takes a Search and returns a Search. Used in nested queries.

Parameters
NameType
searchSearch<T>
Returns

Search<T>

Defined in

lib/search/search.ts:31


TextFieldDefinition

Ƭ TextFieldDefinition: { type: "text" } & CommonFieldDefinition & Pick<AllFieldDefinition, "sortable" | "normalized" | "matcher" | "stemming" | "weight">

A field representing searchable text.

Defined in

lib/schema/definitions.ts:114

Variables

EntityId

Const EntityId: typeof EntityId

The Symbol used to access the entity ID of an Entity.

Defined in

lib/entity/entity.ts:2


EntityKeyName

Const EntityKeyName: typeof EntityKeyName

The Symbol used to access the keyname of an Entity.

Defined in

lib/entity/entity.ts:5