diff --git a/docs/README.md b/docs/README.md index 55f9234c..0cb7375d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,8 +6,11 @@ redis-om ### Classes +- [AbstractSearch](classes/AbstractSearch.md) +- [Circle](classes/Circle.md) - [Client](classes/Client.md) - [Entity](classes/Entity.md) +- [RawSearch](classes/RawSearch.md) - [RedisError](classes/RedisError.md) - [Repository](classes/Repository.md) - [Schema](classes/Schema.md) @@ -17,19 +20,25 @@ redis-om ### Interfaces -- [ArrayField](interfaces/ArrayField.md) - [BooleanField](interfaces/BooleanField.md) +- [DateField](interfaces/DateField.md) - [Field](interfaces/Field.md) -- [NumericField](interfaces/NumericField.md) +- [NumberField](interfaces/NumberField.md) +- [PointField](interfaces/PointField.md) +- [StringArrayField](interfaces/StringArrayField.md) - [StringField](interfaces/StringField.md) +- [TextField](interfaces/TextField.md) ### Type aliases +- [CircleFunction](README.md#circlefunction) - [EntityConstructor](README.md#entityconstructor) - [EntityCreationData](README.md#entitycreationdata) - [EntityData](README.md#entitydata) +- [EntityValue](README.md#entityvalue) - [FieldDefinition](README.md#fielddefinition) - [IdStrategy](README.md#idstrategy) +- [Point](README.md#point) - [SchemaDefinition](README.md#schemadefinition) - [SchemaOptions](README.md#schemaoptions) - [SearchDataStructure](README.md#searchdatastructure) @@ -38,9 +47,35 @@ redis-om ## Type aliases +### CircleFunction + +Ƭ **CircleFunction**: (`circle`: [`Circle`](classes/Circle.md)) => [`Circle`](classes/Circle.md) + +#### Type declaration + +▸ (`circle`): [`Circle`](classes/Circle.md) + +A function that defines a circle for `.inCircle` searches. + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `circle` | [`Circle`](classes/Circle.md) | + +##### Returns + +[`Circle`](classes/Circle.md) + +#### Defined in + +[lib/search/where-point.ts:9](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L9) + +___ + ### EntityConstructor -Ƭ **EntityConstructor**<`TEntity`\>: (`schemaDef`: [`SchemaDefinition`](README.md#schemadefinition), `id`: `string`, `data?`: [`EntityData`](README.md#entitydata)) => `TEntity` +Ƭ **EntityConstructor**<`TEntity`\>: (`schema`: [`Schema`](classes/Schema.md)<`any`\>, `id`: `string`, `data?`: [`EntityData`](README.md#entitydata)) => `TEntity` #### Type parameters @@ -50,7 +85,7 @@ redis-om #### Type declaration -• (`schemaDef`, `id`, `data?`) +• (`schema`, `id`, `data?`) A constructor that creates an [Entity](classes/Entity.md) of type TEntity. @@ -58,50 +93,62 @@ A constructor that creates an [Entity](classes/Entity.md) of type TEntity. | Name | Type | | :------ | :------ | -| `schemaDef` | [`SchemaDefinition`](README.md#schemadefinition) | +| `schema` | [`Schema`](classes/Schema.md)<`any`\> | | `id` | `string` | | `data?` | [`EntityData`](README.md#entitydata) | #### Defined in -[lib/entity/entity.ts:12](https://github.com/redis/redis-om-node/blob/ee688a6/lib/entity/entity.ts#L12) +[lib/entity/entity.ts:18](https://github.com/redis/redis-om-node/blob/39d7998/lib/entity/entity.ts#L18) ___ ### EntityCreationData -Ƭ **EntityCreationData**: `Record`<`string`, `number` \| `boolean` \| `string` \| `string`[] \| ``null``\> +Ƭ **EntityCreationData**: `Record`<`string`, `number` \| `boolean` \| `string` \| `string`[] \| [`Point`](README.md#point) \| `Date` \| ``null``\> Initialization data for [Entity](classes/Entity.md) creation when calling [Repository.createEntity](classes/Repository.md#createentity) or [Repository.createAndSave](classes/Repository.md#createandsave). #### Defined in -[lib/repository/repository.ts:14](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L14) +[lib/repository/repository.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L15) ___ ### EntityData -Ƭ **EntityData**: `Record`<`string`, `number` \| `boolean` \| `string` \| `string`[]\> +Ƭ **EntityData**: `Record`<`string`, [`EntityValue`](README.md#entityvalue)\> A JavaScript object containing the underlying data of an [Entity](classes/Entity.md). #### Defined in -[lib/entity/entity.ts:6](https://github.com/redis/redis-om-node/blob/ee688a6/lib/entity/entity.ts#L6) +[lib/entity/entity.ts:12](https://github.com/redis/redis-om-node/blob/39d7998/lib/entity/entity.ts#L12) + +___ + +### EntityValue + +Ƭ **EntityValue**: `number` \| `boolean` \| `string` \| [`Point`](README.md#point) \| `Date` \| `string`[] + +Valid values for properties of an [Entity](classes/Entity.md). + +#### Defined in + +[lib/entity/entity.ts:7](https://github.com/redis/redis-om-node/blob/39d7998/lib/entity/entity.ts#L7) ___ ### FieldDefinition -Ƭ **FieldDefinition**: [`NumericField`](interfaces/NumericField.md) \| [`StringField`](interfaces/StringField.md) \| [`BooleanField`](interfaces/BooleanField.md) \| [`ArrayField`](interfaces/ArrayField.md) +Ƭ **FieldDefinition**: [`StringField`](interfaces/StringField.md) \| [`TextField`](interfaces/TextField.md) \| [`NumberField`](interfaces/NumberField.md) \| [`BooleanField`](interfaces/BooleanField.md) \| [`PointField`](interfaces/PointField.md) \| [`DateField`](interfaces/DateField.md) \| [`StringArrayField`](interfaces/StringArrayField.md) Contains instructions telling how to map a property on an [Entity](classes/Entity.md) to Redis. #### Defined in -[lib/schema/schema-definitions.ts:54](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L54) +[lib/schema/schema-definitions.ts:77](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L77) ___ @@ -121,7 +168,26 @@ A function that generates random [Entity IDs](classes/Entity.md#entityid). #### Defined in -[lib/schema/schema-definitions.ts:62](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L62) +[lib/schema/schema-definitions.ts:85](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L85) + +___ + +### Point + +Ƭ **Point**: `Object` + +Defines a point on the globe using longitude and latitude. + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `latitude` | `number` | The latitude of the point. | +| `longitude` | `number` | The longitude of the point. | + +#### Defined in + +[lib/schema/schema-definitions.ts:2](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L2) ___ @@ -133,7 +199,7 @@ Group of [FieldDefinition](README.md#fielddefinition)s that define the schema fo #### Defined in -[lib/schema/schema-definitions.ts:59](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L59) +[lib/schema/schema-definitions.ts:82](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L82) ___ @@ -147,8 +213,9 @@ Configuration options for a [Schema](classes/Schema.md). | Name | Type | Description | | :------ | :------ | :------ | -| `dataStructure?` | [`SearchDataStructure`](README.md#searchdatastructure) | The data structure used to store the [Entity](classes/Entity.md) in Redis. | +| `dataStructure?` | [`SearchDataStructure`](README.md#searchdatastructure) | The data structure used to store the [Entity](classes/Entity.md) in Redis. Can be set to either `JSON` or `HASH`. Defaults to JSON. | | `idStrategy?` | [`IdStrategy`](README.md#idstrategy) | A function that generates a random [Entity ID](classes/Entity.md#entityid). Defaults to a function that generates [ULIDs](https://github.com/ulid/spec). 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?` | `string` | The name used by Redis OM to store the hash of the index for this [Schema](classes/Schema.md). Defaults to prefix followed by `:index:hash`. So, for a prefix of `Foo`, it would use `Foo:index:hash`. | | `indexName?` | `string` | The name used by RediSearch to store the index for this [Schema](classes/Schema.md). Defaults to prefix followed by `:index`. So, for a prefix of `Foo`, it would use `Foo:index`. | | `prefix?` | `string` | The string that comes before the ID when creating Redis keys for [Entities](classes/Entity.md). Defaults to the class name of the [Entity](classes/Entity.md). Combined with the results of idStrategy to generate a key. If prefix is `Foo` and idStrategy returns `12345` then the generated key would be `Foo:12345`. | | `stopWords?` | `string`[] | Stop words to be used by this schema. If `useStopWords` is anything other than `CUSTOM`, this option is ignored. | @@ -156,7 +223,7 @@ Configuration options for a [Schema](classes/Schema.md). #### Defined in -[lib/schema/schema-options.ts:7](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-options.ts#L7) +[lib/schema/schema-options.ts:7](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-options.ts#L7) ___ @@ -168,7 +235,7 @@ The type of data structure in Redis to map objects to. #### Defined in -[lib/client.ts:21](https://github.com/redis/redis-om-node/blob/ee688a6/lib/client.ts#L21) +[lib/client.ts:21](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L21) ___ @@ -180,7 +247,7 @@ Valid values for how to use stop words for a given [Schema](classes/Schema.md). #### Defined in -[lib/schema/schema-definitions.ts:65](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L65) +[lib/schema/schema-definitions.ts:88](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L88) ___ @@ -212,4 +279,4 @@ A function that takes a [Search](classes/Search.md) and returns a [Search](class #### Defined in -[lib/search/search.ts:22](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L22) +[lib/search/search.ts:24](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L24) diff --git a/docs/classes/AbstractSearch.md b/docs/classes/AbstractSearch.md new file mode 100644 index 00000000..ed39d411 --- /dev/null +++ b/docs/classes/AbstractSearch.md @@ -0,0 +1,222 @@ +[redis-om](../README.md) / AbstractSearch + +# Class: AbstractSearch + +Abstract base class for [Search](Search.md) and [RawSearch](RawSearch.md) that +contains methods to return search results. + +## Type parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) being sought. | + +## Hierarchy + +- **`AbstractSearch`** + + ↳ [`Search`](Search.md) + + ↳ [`RawSearch`](RawSearch.md) + +## Table of contents + +### Accessors + +- [return](AbstractSearch.md#return) + +### Methods + +- [all](AbstractSearch.md#all) +- [count](AbstractSearch.md#count) +- [first](AbstractSearch.md#first) +- [page](AbstractSearch.md#page) +- [returnAll](AbstractSearch.md#returnall) +- [returnCount](AbstractSearch.md#returncount) +- [returnFirst](AbstractSearch.md#returnfirst) +- [returnPage](AbstractSearch.md#returnpage) + +## Accessors + +### return + +• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> + +Returns the current instance. Syntactic sugar to make your code more fluent. + +#### Returns + +[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> + +this + +#### Defined in + +[lib/search/search.ts:115](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L115) + +## Methods + +### all + +▸ **all**(`options?`): `Promise`<`TEntity`[]\> + +Returns all the [Entities](Entity.md) that match this query. This method +makes multiple calls to Redis until all the [Entities](Entity.md) are returned. +You can specify the batch size by setting the `pageSize` property on the +options: + +```typescript +let entities = await repository.search().returnAll({ pageSize: 100 }); +``` + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `options` | `Object` | `undefined` | Options for the call. | +| `options.pageSize` | `number` | `10` | Number of [Entities](Entity.md) returned per batch. | + +#### Returns + +`Promise`<`TEntity`[]\> + +An array of [Entities](Entity.md) matching the query. + +#### Defined in + +[lib/search/search.ts:96](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L96) + +___ + +### count + +▸ **count**(): `Promise`<`number`\> + +Returns the number of [Entities](Entity.md) that match this query. + +#### Returns + +`Promise`<`number`\> + +#### Defined in + +[lib/search/search.ts:54](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L54) + +___ + +### first + +▸ **first**(): `Promise`<`TEntity`\> + +Returns only the first [Entity](Entity.md) that matches this query. + +#### Returns + +`Promise`<`TEntity`\> + +#### Defined in + +[lib/search/search.ts:77](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L77) + +___ + +### page + +▸ **page**(`offset`, `count`): `Promise`<`TEntity`[]\> + +Returns a page of [Entities](Entity.md) that match this query. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `offset` | `number` | The offset for where to start returning [Entities](Entity.md). | +| `count` | `number` | - | + +#### Returns + +`Promise`<`TEntity`[]\> + +An array of [Entities](Entity.md) matching the query. + +#### Defined in + +[lib/search/search.ts:67](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L67) + +___ + +### returnAll + +▸ **returnAll**(`options?`): `Promise`<`TEntity`[]\> + +Alias for [Search.all](Search.md#all). + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `options` | `Object` | `undefined` | +| `options.pageSize` | `number` | `10` | + +#### Returns + +`Promise`<`TEntity`[]\> + +#### Defined in + +[lib/search/search.ts:136](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L136) + +___ + +### returnCount + +▸ **returnCount**(): `Promise`<`number`\> + +Alias for [Search.count](Search.md#count). + +#### Returns + +`Promise`<`number`\> + +#### Defined in + +[lib/search/search.ts:122](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L122) + +___ + +### returnFirst + +▸ **returnFirst**(): `Promise`<`TEntity`\> + +Alias for [Search.first](Search.md#first). + +#### Returns + +`Promise`<`TEntity`\> + +#### Defined in + +[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L144) + +___ + +### returnPage + +▸ **returnPage**(`offset`, `count`): `Promise`<`TEntity`[]\> + +Alias for [Search.page](Search.md#page). + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `offset` | `number` | +| `count` | `number` | + +#### Returns + +`Promise`<`TEntity`[]\> + +#### Defined in + +[lib/search/search.ts:129](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L129) diff --git a/docs/classes/Circle.md b/docs/classes/Circle.md new file mode 100644 index 00000000..1e5fadd6 --- /dev/null +++ b/docs/classes/Circle.md @@ -0,0 +1,327 @@ +[redis-om](../README.md) / Circle + +# Class: Circle + +A builder that defines a circle. + +## Table of contents + +### Constructors + +- [constructor](Circle.md#constructor) + +### Accessors + +- [feet](Circle.md#feet) +- [foot](Circle.md#foot) +- [ft](Circle.md#ft) +- [kilometer](Circle.md#kilometer) +- [kilometers](Circle.md#kilometers) +- [km](Circle.md#km) +- [m](Circle.md#m) +- [meter](Circle.md#meter) +- [meters](Circle.md#meters) +- [mi](Circle.md#mi) +- [mile](Circle.md#mile) +- [miles](Circle.md#miles) + +### Methods + +- [latitude](Circle.md#latitude) +- [longitude](Circle.md#longitude) +- [radius](Circle.md#radius) + +## Constructors + +### constructor + +• **new Circle**() + +## Accessors + +### feet + +• `get` **feet**(): `this` + +Sets the units to feet. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:150](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L150) + +___ + +### foot + +• `get` **foot**(): `this` + +Sets the units to feet. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:144](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L144) + +___ + +### ft + +• `get` **ft**(): `this` + +Sets the units to feet. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:138](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L138) + +___ + +### kilometer + +• `get` **kilometer**(): `this` + +Sets the units to kilometers. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:123](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L123) + +___ + +### kilometers + +• `get` **kilometers**(): `this` + +Sets the units to kilometers. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:129](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L129) + +___ + +### km + +• `get` **km**(): `this` + +Sets the units to kilometers. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:117](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L117) + +___ + +### m + +• `get` **m**(): `this` + +Sets the units to meters. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:96](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L96) + +___ + +### meter + +• `get` **meter**(): `this` + +Sets the units to meters. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:102](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L102) + +___ + +### meters + +• `get` **meters**(): `this` + +Sets the units to meters. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:108](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L108) + +___ + +### mi + +• `get` **mi**(): `this` + +Sets the units to miles. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:159](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L159) + +___ + +### mile + +• `get` **mile**(): `this` + +Sets the units to miles. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:165](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L165) + +___ + +### miles + +• `get` **miles**(): `this` + +Sets the units to miles. + +#### Returns + +`this` + +This instance. + +#### Defined in + +[lib/search/where-point.ts:171](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L171) + +## Methods + +### latitude + +▸ **latitude**(`value`): [`Circle`](Circle.md) + +Sets the latitude. If not set, defaults to 0.0. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `number` | The latitude. | + +#### Returns + +[`Circle`](Circle.md) + +This instance. + +#### Defined in + +[lib/search/where-point.ts:43](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L43) + +___ + +### longitude + +▸ **longitude**(`value`): [`Circle`](Circle.md) + +Sets the longitude. If not set, defaults to 0.0. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `value` | `number` | The longitude. | + +#### Returns + +[`Circle`](Circle.md) + +This instance. + +#### Defined in + +[lib/search/where-point.ts:32](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L32) + +___ + +### radius + +▸ **radius**(`size`): [`Circle`](Circle.md) + +Sets the radius of the [Circle](Circle.md). Defaults to 1. If units are +not specified, defaults to meters. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `size` | `number` | The radius of the circle. | + +#### Returns + +[`Circle`](Circle.md) + +This instance. + +#### Defined in + +[lib/search/where-point.ts:87](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-point.ts#L87) diff --git a/docs/classes/Client.md b/docs/classes/Client.md index 4e00736d..269b0619 100644 --- a/docs/classes/Client.md +++ b/docs/classes/Client.md @@ -27,6 +27,7 @@ its constructor. - [fetchRepository](Client.md#fetchrepository) - [isOpen](Client.md#isopen) - [open](Client.md#open) +- [use](Client.md#use) ## Constructors @@ -48,7 +49,7 @@ Close the connection to Redis. #### Defined in -[lib/client.ts:95](https://github.com/redis/redis-om-node/blob/ee688a6/lib/client.ts#L95) +[lib/client.ts:115](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L115) ___ @@ -78,7 +79,7 @@ The raw results of calling the Redis command. #### Defined in -[lib/client.ts:72](https://github.com/redis/redis-om-node/blob/ee688a6/lib/client.ts#L72) +[lib/client.ts:88](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L88) ___ @@ -108,7 +109,7 @@ A repository for the provided schema. #### Defined in -[lib/client.ts:87](https://github.com/redis/redis-om-node/blob/ee688a6/lib/client.ts#L87) +[lib/client.ts:103](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L103) ___ @@ -120,17 +121,17 @@ ___ `boolean` -Whether a connection is already open +Whether a connection is already open. #### Defined in -[lib/client.ts:168](https://github.com/redis/redis-om-node/blob/ee688a6/lib/client.ts#L168) +[lib/client.ts:207](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L207) ___ ### open -▸ **open**(`url?`): `Promise`<`void`\> +▸ **open**(`url?`): `Promise`<[`Client`](Client.md)\> Open a connection to Redis at the provided URL. @@ -142,8 +143,35 @@ Open a connection to Redis at the provided URL. #### Returns -`Promise`<`void`\> +`Promise`<[`Client`](Client.md)\> + +This [Client](Client.md) instance. + +#### Defined in + +[lib/client.ts:74](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L74) + +___ + +### use + +▸ **use**(`connection`): `Promise`<[`Client`](Client.md)\> + +Attaches an existing Node Redis connection to this Redis OM client. Closes +any existing connection. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `connection` | `RedisClientType`<{ `bf`: { `ADD`: `__module` ; `EXISTS`: `__module` ; `INFO`: `__module` ; `INSERT`: `__module` ; `LOADCHUNK`: `__module` ; `MADD`: `__module` ; `MEXISTS`: `__module` ; `RESERVE`: `__module` ; `SCANDUMP`: `__module` ; `add`: `__module` ; `exists`: `__module` ; `info`: `__module` ; `insert`: `__module` ; `loadChunk`: `__module` ; `mAdd`: `__module` ; `mExists`: `__module` ; `reserve`: `__module` ; `scanDump`: `__module` } ; `cf`: { `ADD`: `__module` ; `ADDNX`: `__module` ; `COUNT`: `__module` ; `DEL`: `__module` ; `EXISTS`: `__module` ; `INFO`: `__module` ; `INSERT`: `__module` ; `INSERTNX`: `__module` ; `LOADCHUNK`: `__module` ; `RESERVE`: `__module` ; `SCANDUMP`: `__module` ; `add`: `__module` ; `addNX`: `__module` ; `count`: `__module` ; `del`: `__module` ; `exists`: `__module` ; `info`: `__module` ; `insert`: `__module` ; `insertNX`: `__module` ; `loadChunk`: `__module` ; `reserve`: `__module` ; `scanDump`: `__module` } ; `cms`: { `INCRBY`: `__module` ; `INFO`: `__module` ; `INITBYDIM`: `__module` ; `INITBYPROB`: `__module` ; `MERGE`: `__module` ; `QUERY`: `__module` ; `incrBy`: `__module` ; `info`: `__module` ; `initByDim`: `__module` ; `initByProb`: `__module` ; `merge`: `__module` ; `query`: `__module` } ; `ft`: { `AGGREGATE`: `__module` ; `ALIASADD`: `__module` ; `ALIASDEL`: `__module` ; `ALIASUPDATE`: `__module` ; `ALTER`: `__module` ; `CONFIG_GET`: `__module` ; `CONFIG_SET`: `__module` ; `CREATE`: `__module` ; `DICTADD`: `__module` ; `DICTDEL`: `__module` ; `DICTDUMP`: `__module` ; `DROPINDEX`: `__module` ; `EXPLAIN`: `__module` ; `EXPLAINCLI`: `__module` ; `INFO`: `__module` ; `PROFILEAGGREGATE`: `__module` ; `PROFILESEARCH`: `__module` ; `SEARCH`: `__module` ; `SPELLCHECK`: `__module` ; `SUGADD`: `__module` ; `SUGDEL`: `__module` ; `SUGGET`: `__module` ; `SUGGET_WITHPAYLOADS`: `__module` ; `SUGGET_WITHSCORES`: `__module` ; `SUGGET_WITHSCORES_WITHPAYLOADS`: `__module` ; `SUGLEN`: `__module` ; `SYNDUMP`: `__module` ; `SYNUPDATE`: `__module` ; `TAGVALS`: `__module` ; `_LIST`: `__module` ; `_list`: `__module` ; `aggregate`: `__module` ; `aliasAdd`: `__module` ; `aliasDel`: `__module` ; `aliasUpdate`: `__module` ; `alter`: `__module` ; `configGet`: `__module` ; `configSet`: `__module` ; `create`: `__module` ; `dictAdd`: `__module` ; `dictDel`: `__module` ; `dictDump`: `__module` ; `dropIndex`: `__module` ; `explain`: `__module` ; `explainCli`: `__module` ; `info`: `__module` ; `profileAggregate`: `__module` ; `profileSearch`: `__module` ; `search`: `__module` ; `spellCheck`: `__module` ; `sugAdd`: `__module` ; `sugDel`: `__module` ; `sugGet`: `__module` ; `sugGetWithPayloads`: `__module` ; `sugGetWithScores`: `__module` ; `sugGetWithScoresWithPayloads`: `__module` ; `sugLen`: `__module` ; `synDump`: `__module` ; `synUpdate`: `__module` ; `tagVals`: `__module` } ; `graph`: { `CONFIG_GET`: `__module` ; `CONFIG_SET`: `__module` ; `DELETE`: `__module` ; `EXPLAIN`: `__module` ; `LIST`: `__module` ; `PROFILE`: `__module` ; `QUERY`: `__module` ; `QUERY_RO`: `__module` ; `SLOWLOG`: `__module` ; `configGet`: `__module` ; `configSet`: `__module` ; `delete`: `__module` ; `explain`: `__module` ; `list`: `__module` ; `profile`: `__module` ; `query`: `__module` ; `queryRo`: `__module` ; `slowLog`: `__module` } ; `json`: { `ARRAPPEND`: `__module` ; `ARRINDEX`: `__module` ; `ARRINSERT`: `__module` ; `ARRLEN`: `__module` ; `ARRPOP`: `__module` ; `ARRTRIM`: `__module` ; `DEBUG_MEMORY`: `__module` ; `DEL`: `__module` ; `FORGET`: `__module` ; `GET`: `__module` ; `MGET`: `__module` ; `NUMINCRBY`: `__module` ; `NUMMULTBY`: `__module` ; `OBJKEYS`: `__module` ; `OBJLEN`: `__module` ; `RESP`: `__module` ; `SET`: `__module` ; `STRAPPEND`: `__module` ; `STRLEN`: `__module` ; `TYPE`: `__module` ; `arrAppend`: `__module` ; `arrIndex`: `__module` ; `arrInsert`: `__module` ; `arrLen`: `__module` ; `arrPop`: `__module` ; `arrTrim`: `__module` ; `debugMemory`: `__module` ; `del`: `__module` ; `forget`: `__module` ; `get`: `__module` ; `mGet`: `__module` ; `numIncrBy`: `__module` ; `numMultBy`: `__module` ; `objKeys`: `__module` ; `objLen`: `__module` ; `resp`: `__module` ; `set`: `__module` ; `strAppend`: `__module` ; `strLen`: `__module` ; `type`: `__module` } ; `topK`: { `ADD`: `__module` ; `COUNT`: `__module` ; `INCRBY`: `__module` ; `INFO`: `__module` ; `LIST`: `__module` ; `QUERY`: `__module` ; `RESERVE`: `__module` ; `add`: `__module` ; `count`: `__module` ; `incrBy`: `__module` ; `info`: `__module` ; `list`: `__module` ; `query`: `__module` ; `reserve`: `__module` } ; `ts`: { `ADD`: `__module` ; `ALTER`: `__module` ; `CREATE`: `__module` ; `CREATERULE`: `__module` ; `DECRBY`: `__module` ; `DEL`: `__module` ; `DELETERULE`: `__module` ; `GET`: `__module` ; `INCRBY`: `__module` ; `INFO`: `__module` ; `INFO_DEBUG`: `__module` ; `MADD`: `__module` ; `MGET`: `__module` ; `MGET_WITHLABELS`: `__module` ; `MRANGE`: `__module` ; `MRANGE_WITHLABELS`: `__module` ; `MREVRANGE`: `__module` ; `MREVRANGE_WITHLABELS`: `__module` ; `QUERYINDEX`: `__module` ; `RANGE`: `__module` ; `REVRANGE`: `__module` ; `add`: `__module` ; `alter`: `__module` ; `create`: `__module` ; `createRule`: `__module` ; `decrBy`: `__module` ; `del`: `__module` ; `deleteRule`: `__module` ; `get`: `__module` ; `incrBy`: `__module` ; `info`: `__module` ; `infoDebug`: `__module` ; `mAdd`: `__module` ; `mGet`: `__module` ; `mGetWithLabels`: `__module` ; `mRange`: `__module` ; `mRangeWithLabels`: `__module` ; `mRevRange`: `__module` ; `mRevRangeWithLabels`: `__module` ; `queryIndex`: `__module` ; `range`: `__module` ; `revRange`: `__module` } } & `RedisModules`, `RedisScripts`\> | An existing Node Redis client. | + +#### Returns + +`Promise`<[`Client`](Client.md)\> + +This [Client](Client.md) instance. #### Defined in -[lib/client.ts:60](https://github.com/redis/redis-om-node/blob/ee688a6/lib/client.ts#L60) +[lib/client.ts:63](https://github.com/redis/redis-om-node/blob/39d7998/lib/client.ts#L63) diff --git a/docs/classes/Entity.md b/docs/classes/Entity.md index 83daef0a..b83bbe04 100644 --- a/docs/classes/Entity.md +++ b/docs/classes/Entity.md @@ -15,6 +15,10 @@ class Foo extends Entity {} - [entityId](Entity.md#entityid) +### Accessors + +- [keyName](Entity.md#keyname) + ### Methods - [toJSON](Entity.md#tojson) @@ -29,7 +33,21 @@ The generated entity ID. #### Defined in -[lib/entity/entity.ts:27](https://github.com/redis/redis-om-node/blob/ee688a6/lib/entity/entity.ts#L27) +[lib/entity/entity.ts:33](https://github.com/redis/redis-om-node/blob/39d7998/lib/entity/entity.ts#L33) + +## Accessors + +### keyName + +• `get` **keyName**(): `string` + +#### Returns + +`string` + +#### Defined in + +[lib/entity/entity.ts:55](https://github.com/redis/redis-om-node/blob/39d7998/lib/entity/entity.ts#L55) ## Methods @@ -43,4 +61,4 @@ The generated entity ID. #### Defined in -[lib/entity/entity.ts:47](https://github.com/redis/redis-om-node/blob/ee688a6/lib/entity/entity.ts#L47) +[lib/entity/entity.ts:59](https://github.com/redis/redis-om-node/blob/39d7998/lib/entity/entity.ts#L59) diff --git a/docs/classes/RawSearch.md b/docs/classes/RawSearch.md new file mode 100644 index 00000000..d52f6b80 --- /dev/null +++ b/docs/classes/RawSearch.md @@ -0,0 +1,257 @@ +[redis-om](../README.md) / RawSearch + +# Class: RawSearch + +Entry point to raw search which allows using raw RediSearch queries +against Redis OM. Requires that RediSearch (and optionally RedisJSON) be +installed. + +## Type parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) being sought. | + +## Hierarchy + +- [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> + + ↳ **`RawSearch`** + +## Table of contents + +### Accessors + +- [return](RawSearch.md#return) + +### Methods + +- [all](RawSearch.md#all) +- [count](RawSearch.md#count) +- [first](RawSearch.md#first) +- [page](RawSearch.md#page) +- [returnAll](RawSearch.md#returnall) +- [returnCount](RawSearch.md#returncount) +- [returnFirst](RawSearch.md#returnfirst) +- [returnPage](RawSearch.md#returnpage) + +## Accessors + +### return + +• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> + +Returns the current instance. Syntactic sugar to make your code more fluent. + +#### Returns + +[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> + +this + +#### Inherited from + +AbstractSearch.return + +#### Defined in + +[lib/search/search.ts:115](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L115) + +## Methods + +### all + +▸ **all**(`options?`): `Promise`<`TEntity`[]\> + +Returns all the [Entities](Entity.md) that match this query. This method +makes multiple calls to Redis until all the [Entities](Entity.md) are returned. +You can specify the batch size by setting the `pageSize` property on the +options: + +```typescript +let entities = await repository.search().returnAll({ pageSize: 100 }); +``` + +#### Parameters + +| Name | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `options` | `Object` | `undefined` | Options for the call. | +| `options.pageSize` | `number` | `10` | Number of [Entities](Entity.md) returned per batch. | + +#### Returns + +`Promise`<`TEntity`[]\> + +An array of [Entities](Entity.md) matching the query. + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[all](AbstractSearch.md#all) + +#### Defined in + +[lib/search/search.ts:96](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L96) + +___ + +### count + +▸ **count**(): `Promise`<`number`\> + +Returns the number of [Entities](Entity.md) that match this query. + +#### Returns + +`Promise`<`number`\> + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[count](AbstractSearch.md#count) + +#### Defined in + +[lib/search/search.ts:54](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L54) + +___ + +### first + +▸ **first**(): `Promise`<`TEntity`\> + +Returns only the first [Entity](Entity.md) that matches this query. + +#### Returns + +`Promise`<`TEntity`\> + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[first](AbstractSearch.md#first) + +#### Defined in + +[lib/search/search.ts:77](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L77) + +___ + +### page + +▸ **page**(`offset`, `count`): `Promise`<`TEntity`[]\> + +Returns a page of [Entities](Entity.md) that match this query. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `offset` | `number` | The offset for where to start returning [Entities](Entity.md). | +| `count` | `number` | - | + +#### Returns + +`Promise`<`TEntity`[]\> + +An array of [Entities](Entity.md) matching the query. + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[page](AbstractSearch.md#page) + +#### Defined in + +[lib/search/search.ts:67](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L67) + +___ + +### returnAll + +▸ **returnAll**(`options?`): `Promise`<`TEntity`[]\> + +Alias for [Search.all](Search.md#all). + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `options` | `Object` | `undefined` | +| `options.pageSize` | `number` | `10` | + +#### Returns + +`Promise`<`TEntity`[]\> + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnAll](AbstractSearch.md#returnall) + +#### Defined in + +[lib/search/search.ts:136](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L136) + +___ + +### returnCount + +▸ **returnCount**(): `Promise`<`number`\> + +Alias for [Search.count](Search.md#count). + +#### Returns + +`Promise`<`number`\> + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnCount](AbstractSearch.md#returncount) + +#### Defined in + +[lib/search/search.ts:122](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L122) + +___ + +### returnFirst + +▸ **returnFirst**(): `Promise`<`TEntity`\> + +Alias for [Search.first](Search.md#first). + +#### Returns + +`Promise`<`TEntity`\> + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnFirst](AbstractSearch.md#returnfirst) + +#### Defined in + +[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L144) + +___ + +### returnPage + +▸ **returnPage**(`offset`, `count`): `Promise`<`TEntity`[]\> + +Alias for [Search.page](Search.md#page). + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `offset` | `number` | +| `count` | `number` | + +#### Returns + +`Promise`<`TEntity`[]\> + +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnPage](AbstractSearch.md#returnpage) + +#### Defined in + +[lib/search/search.ts:129](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L129) diff --git a/docs/classes/RedisError.md b/docs/classes/RedisError.md index 11577a06..5acf3575 100644 --- a/docs/classes/RedisError.md +++ b/docs/classes/RedisError.md @@ -44,7 +44,7 @@ Error.constructor #### Defined in -[lib/errors.ts:2](https://github.com/redis/redis-om-node/blob/ee688a6/lib/errors.ts#L2) +[lib/errors.ts:2](https://github.com/redis/redis-om-node/blob/39d7998/lib/errors.ts#L2) ## Properties diff --git a/docs/classes/Repository.md b/docs/classes/Repository.md index 41a95cc4..34945e2b 100644 --- a/docs/classes/Repository.md +++ b/docs/classes/Repository.md @@ -3,13 +3,13 @@ # Class: Repository A repository is the main interaction point for reading, writing, and -removing [Entities](Entity.md) from Redis. Create one by passing -in a [Schema](Schema.md) and a [Client](Client.md). Then use the [Repository.fetch](Repository.md#fetch), -[Repository.save](Repository.md#save), and [Repository.remove](Repository.md#remove) methods to manage your -data: +removing [Entities](Entity.md) from Redis. Create one by calling +[Client.fetchRepository](Client.md#fetchrepository) and passing in a [Schema](Schema.md). Then +use the [Repository.fetch](Repository.md#fetch), [Repository.save](Repository.md#save), and +[Repository.remove](Repository.md#remove) methods to manage your data: ```typescript -let repository = new Repository(schema, client); +let repository = client.fetchRepository(schema); let foo = await repository.fetch('01FK6TCJBDK41RJ766A4SBWDJ9'); foo.aString = 'bar'; @@ -17,8 +17,8 @@ foo.aBoolean = false; await repository.save(foo); ``` -Be sure to use the repository to create a new instance of [Entity](Entity.md) you want -to create before you save it: +Be sure to use the repository to create a new instance of an +[Entity](Entity.md) you want to create before you save it: ```typescript let foo = await repository.createEntity(); @@ -45,9 +45,9 @@ let entities = await repository.search() ## Table of contents -### Constructors +### Properties -- [constructor](Repository.md#constructor) +- [client](Repository.md#client) ### Methods @@ -55,35 +55,22 @@ let entities = await repository.search() - [createEntity](Repository.md#createentity) - [createIndex](Repository.md#createindex) - [dropIndex](Repository.md#dropindex) +- [expire](Repository.md#expire) - [fetch](Repository.md#fetch) - [remove](Repository.md#remove) - [save](Repository.md#save) - [search](Repository.md#search) +- [searchRaw](Repository.md#searchraw) -## Constructors +## Properties -### constructor +### client -• **new Repository**<`TEntity`\>(`schema`, `client`) - -Constructs a new Repository. - -#### Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md)<`TEntity`\> | The type of [Entity](Entity.md) that this repository manages. | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `schema` | [`Schema`](Schema.md)<`TEntity`\> | The [Schema](Schema.md) for this Repository. | -| `client` | [`Client`](Client.md) | An open [Client](Client.md). | +• `Protected` **client**: [`Client`](Client.md) #### Defined in -[lib/repository/repository.ts:66](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L66) +[lib/repository/repository.ts:56](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L56) ## Methods @@ -108,7 +95,7 @@ The newly created and saved Entity. #### Defined in -[lib/repository/repository.ts:156](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L156) +[lib/repository/repository.ts:150](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L150) ___ @@ -132,7 +119,7 @@ A newly created Entity. #### Defined in -[lib/repository/repository.ts:113](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L113) +[lib/repository/repository.ts:115](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L115) ___ @@ -149,7 +136,7 @@ that RediSearch or RedisJSON is installed on your instance of Redis. #### Defined in -[lib/repository/repository.ts:77](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L77) +[lib/repository/repository.ts:69](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L69) ___ @@ -157,7 +144,7 @@ ___ ▸ **dropIndex**(): `Promise`<`void`\> -Removes an existing index from Redis. Use this method if you want to swap out you index +Removes an existing index from Redis. Use this method if you want to swap out your index because your [Entity](Entity.md) has changed. Requires that RediSearch or RedisJSON is installed on your instance of Redis. @@ -167,7 +154,31 @@ on your instance of Redis. #### Defined in -[lib/repository/repository.ts:96](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L96) +[lib/repository/repository.ts:97](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L97) + +___ + +### expire + +▸ **expire**(`id`, `ttlInSeconds`): `Promise`<`void`\> + +Set the time to live of the [Entity](Entity.md). If the [Entity](Entity.md) is not +found, does nothing. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `id` | `string` | The ID of the [Entity](Entity.md) to set and expiration for. | +| `ttlInSeconds` | `number` | THe time to live in seconds. | + +#### Returns + +`Promise`<`void`\> + +#### Defined in + +[lib/repository/repository.ts:185](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L185) ___ @@ -193,7 +204,7 @@ The matching Entity. #### Defined in -[lib/repository/repository.ts:169](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L169) +[lib/repository/repository.ts:163](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L163) ___ @@ -216,7 +227,7 @@ not found, does nothing. #### Defined in -[lib/repository/repository.ts:190](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L190) +[lib/repository/repository.ts:174](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L174) ___ @@ -241,7 +252,7 @@ The ID of the Entity just saved. #### Defined in -[lib/repository/repository.ts:130](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L130) +[lib/repository/repository.ts:132](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L132) ___ @@ -249,8 +260,8 @@ ___ ▸ **search**(): [`Search`](Search.md)<`TEntity`\> -Kicks off the processes of building a query. Requires that RediSearch or -RedisJSON is installed on your instance of Redis. +Kicks off the process of building a query. Requires that RediSearch (and optionally +RedisJSON) be is installed on your instance of Redis. #### Returns @@ -260,4 +271,32 @@ A [Search](Search.md) object. #### Defined in -[lib/repository/repository.ts:201](https://github.com/redis/redis-om-node/blob/ee688a6/lib/repository/repository.ts#L201) +[lib/repository/repository.ts:196](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L196) + +___ + +### searchRaw + +▸ **searchRaw**(`query`): [`RawSearch`](RawSearch.md)<`TEntity`\> + +Creates a search that bypassed Redis OM and instead allows you to execute a raw +RediSearch query. Requires that RediSearch (and optionally RedisJSON) be installed +on your instance of Redis. + +**`query`** The raw RediSearch query you want to rune. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `query` | `string` | + +#### Returns + +[`RawSearch`](RawSearch.md)<`TEntity`\> + +A [RawSearch](RawSearch.md) object. + +#### Defined in + +[lib/repository/repository.ts:208](https://github.com/redis/redis-om-node/blob/39d7998/lib/repository/repository.ts#L208) diff --git a/docs/classes/Schema.md b/docs/classes/Schema.md index cd9c127b..0b10def2 100644 --- a/docs/classes/Schema.md +++ b/docs/classes/Schema.md @@ -4,16 +4,19 @@ Defines a schema that determines how an [Entity](Entity.md) is mapped to Redis data structures. Construct by passing in an [EntityConstructor](../README.md#entityconstructor), -a [SchemaDefinition](../README.md#schemadefinition), and [SchemaOptions](../README.md#schemaoptions): +a [SchemaDefinition](../README.md#schemadefinition), and optionally [SchemaOptions](../README.md#schemaoptions): ```typescript let schema = new Schema(Foo, { aString: { type: 'string' }, aNumber: { type: 'number' }, aBoolean: { type: 'boolean' }, - anArray: { type: 'array' } + someText: { type: 'text' }, + aPoint: { type: 'point' }, + aDate: { type: 'date' }, + someStrings: { type: 'string[]' } }, { - dataStructure: 'JSON' + dataStructure: 'HASH' }); ``` @@ -35,6 +38,8 @@ its constructor. ### Accessors - [dataStructure](Schema.md#datastructure) +- [indexHash](Schema.md#indexhash) +- [indexHashName](Schema.md#indexhashname) - [indexName](Schema.md#indexname) - [prefix](Schema.md#prefix) - [stopWords](Schema.md#stopwords) @@ -66,7 +71,7 @@ its constructor. #### Defined in -[lib/schema/schema.ts:54](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L54) +[lib/schema/schema.ts:58](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L58) ## Accessors @@ -83,7 +88,39 @@ that this Schema uses to store [Entities](Entity.md) in Redis. #### Defined in -[lib/schema/schema.ts:73](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L73) +[lib/schema/schema.ts:80](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L80) + +___ + +### indexHash + +• `get` **indexHash**(): `string` + +The hash value of this index. Stored in Redis under [Schema.indexHashName](Schema.md#indexhashname). + +#### Returns + +`string` + +#### Defined in + +[lib/schema/schema.ts:96](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L96) + +___ + +### indexHashName + +• `get` **indexHashName**(): `string` + +The configured name for the RediSearch index hash for this Schema. + +#### Returns + +`string` + +#### Defined in + +[lib/schema/schema.ts:74](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L74) ___ @@ -99,7 +136,7 @@ The configured name for the RediSearch index for this Schema. #### Defined in -[lib/schema/schema.ts:67](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L67) +[lib/schema/schema.ts:71](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L71) ___ @@ -115,7 +152,7 @@ The configured keyspace prefix in Redis for this Schema. #### Defined in -[lib/schema/schema.ts:64](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L64) +[lib/schema/schema.ts:68](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L68) ___ @@ -132,7 +169,7 @@ than `CUSTOM`. #### Defined in -[lib/schema/schema.ts:86](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L86) +[lib/schema/schema.ts:93](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L93) ___ @@ -150,7 +187,7 @@ for more details. #### Defined in -[lib/schema/schema.ts:80](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L80) +[lib/schema/schema.ts:87](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L87) ## Methods @@ -166,4 +203,4 @@ Generates a unique string using the configured [IdStrategy](../README.md#idstrat #### Defined in -[lib/schema/schema.ts:95](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema.ts#L95) +[lib/schema/schema.ts:118](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema.ts#L118) diff --git a/docs/classes/Search.md b/docs/classes/Search.md index 4608867c..2981d4ce 100644 --- a/docs/classes/Search.md +++ b/docs/classes/Search.md @@ -2,7 +2,8 @@ # Class: Search -Entry point to fluent search. Requires the RediSearch or RedisJSON is installed. +Entry point to fluent search. This is the default Redis OM experience. +Requires that RediSearch (and optionally RedisJSON) be installed. ## Type parameters @@ -10,6 +11,12 @@ Entry point to fluent search. Requires the RediSearch or RedisJSON is installed. | :------ | :------ | :------ | | `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) being sought. | +## Hierarchy + +- [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> + + ↳ **`Search`** + ## Table of contents ### Accessors @@ -34,19 +41,23 @@ Entry point to fluent search. Requires the RediSearch or RedisJSON is installed. ### return -• `get` **return**(): [`Search`](Search.md)<`TEntity`\> +• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> Returns the current instance. Syntactic sugar to make your code more fluent. #### Returns -[`Search`](Search.md)<`TEntity`\> +[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> this +#### Inherited from + +AbstractSearch.return + #### Defined in -[lib/search/search.ts:52](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L52) +[lib/search/search.ts:115](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L115) ## Methods @@ -76,9 +87,13 @@ let entities = await repository.search().returnAll({ pageSize: 100 }); An array of [Entities](Entity.md) matching the query. +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[all](AbstractSearch.md#all) + #### Defined in -[lib/search/search.ts:94](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L94) +[lib/search/search.ts:96](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L96) ___ @@ -102,7 +117,7 @@ A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:170](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L170) +[lib/search/search.ts:230](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L230) ▸ **and**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> @@ -122,7 +137,7 @@ Sets up a nested search as a logical AND. #### Defined in -[lib/search/search.ts:177](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L177) +[lib/search/search.ts:237](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L237) ___ @@ -136,9 +151,13 @@ Returns the number of [Entities](Entity.md) that match this query. `Promise`<`number`\> +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[count](AbstractSearch.md#count) + #### Defined in -[lib/search/search.ts:60](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L60) +[lib/search/search.ts:54](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L54) ___ @@ -152,9 +171,13 @@ Returns only the first [Entity](Entity.md) that matches this query. `Promise`<`TEntity`\> +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[first](AbstractSearch.md#first) + #### Defined in -[lib/search/search.ts:112](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L112) +[lib/search/search.ts:77](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L77) ___ @@ -178,7 +201,7 @@ A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:187](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L187) +[lib/search/search.ts:247](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L247) ▸ **or**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> @@ -198,7 +221,7 @@ Sets up a nested search as a logical OR. #### Defined in -[lib/search/search.ts:194](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L194) +[lib/search/search.ts:254](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L254) ___ @@ -221,9 +244,13 @@ Returns a page of [Entities](Entity.md) that match this query. An array of [Entities](Entity.md) matching the query. +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[page](AbstractSearch.md#page) + #### Defined in -[lib/search/search.ts:73](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L73) +[lib/search/search.ts:67](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L67) ___ @@ -244,9 +271,13 @@ Alias for [Search.all](Search.md#all). `Promise`<`TEntity`[]\> +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnAll](AbstractSearch.md#returnall) + #### Defined in -[lib/search/search.ts:134](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L134) +[lib/search/search.ts:136](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L136) ___ @@ -260,9 +291,13 @@ Alias for [Search.count](Search.md#count). `Promise`<`number`\> +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnCount](AbstractSearch.md#returncount) + #### Defined in -[lib/search/search.ts:120](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L120) +[lib/search/search.ts:122](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L122) ___ @@ -270,15 +305,19 @@ ___ ▸ **returnFirst**(): `Promise`<`TEntity`\> -Alias for (@link Search.first). +Alias for [Search.first](Search.md#first). #### Returns `Promise`<`TEntity`\> +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnFirst](AbstractSearch.md#returnfirst) + #### Defined in -[lib/search/search.ts:142](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L142) +[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L144) ___ @@ -299,9 +338,13 @@ Alias for [Search.page](Search.md#page). `Promise`<`TEntity`[]\> +#### Inherited from + +[AbstractSearch](AbstractSearch.md).[returnPage](AbstractSearch.md#returnpage) + #### Defined in -[lib/search/search.ts:127](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L127) +[lib/search/search.ts:129](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L129) ___ @@ -326,7 +369,7 @@ A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:152](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L152) +[lib/search/search.ts:212](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L212) ▸ **where**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> @@ -347,4 +390,4 @@ they are treated logically as AND. #### Defined in -[lib/search/search.ts:160](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/search.ts#L160) +[lib/search/search.ts:220](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/search.ts#L220) diff --git a/docs/classes/Where.md b/docs/classes/Where.md index 97269f64..efb7d871 100644 --- a/docs/classes/Where.md +++ b/docs/classes/Where.md @@ -40,4 +40,4 @@ Converts this [Where](Where.md) into a portion of a RediSearch query. #### Defined in -[lib/search/where.ts:8](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where.ts#L8) +[lib/search/where.ts:8](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where.ts#L8) diff --git a/docs/classes/WhereField.md b/docs/classes/WhereField.md index 9f2d1767..d1724713 100644 --- a/docs/classes/WhereField.md +++ b/docs/classes/WhereField.md @@ -33,6 +33,8 @@ subclass of this is returned. ### Methods +- [after](WhereField.md#after) +- [before](WhereField.md#before) - [between](WhereField.md#between) - [contain](WhereField.md#contain) - [containOneOf](WhereField.md#containoneof) @@ -47,6 +49,8 @@ subclass of this is returned. - [greaterThanOrEqualTo](WhereField.md#greaterthanorequalto) - [gt](WhereField.md#gt) - [gte](WhereField.md#gte) +- [inCircle](WhereField.md#incircle) +- [inRadius](WhereField.md#inradius) - [lessThan](WhereField.md#lessthan) - [lessThanOrEqualTo](WhereField.md#lessthanorequalto) - [lt](WhereField.md#lt) @@ -56,6 +60,9 @@ subclass of this is returned. - [matchExactly](WhereField.md#matchexactly) - [matches](WhereField.md#matches) - [matchesExactly](WhereField.md#matchesexactly) +- [on](WhereField.md#on) +- [onOrAfter](WhereField.md#onorafter) +- [onOrBefore](WhereField.md#onorbefore) - [toString](WhereField.md#tostring) - [true](WhereField.md#true) @@ -72,7 +79,7 @@ this multiple times will have no effect. #### Defined in -[lib/search/where-field.ts:79](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L79) +[lib/search/where-field.ts:92](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L92) ___ @@ -87,7 +94,7 @@ this multiple times will have no effect. #### Defined in -[lib/search/where-field.ts:86](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L86) +[lib/search/where-field.ts:99](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L99) ## Accessors @@ -105,7 +112,7 @@ this #### Defined in -[lib/search/where-field.ts:227](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L227) +[lib/search/where-field.ts:289](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L289) ___ @@ -123,7 +130,7 @@ this #### Defined in -[lib/search/where-field.ts:219](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L219) +[lib/search/where-field.ts:281](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L281) ___ @@ -142,10 +149,58 @@ this #### Defined in -[lib/search/where-field.ts:236](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L236) +[lib/search/where-field.ts:298](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L298) ## Methods +### after + +▸ **after**(`value`): [`Search`](Search.md)<`TEntity`\> + +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`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:240](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L240) + +___ + +### before + +▸ **before**(`value`): [`Search`](Search.md)<`TEntity`\> + +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`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:233](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L233) + +___ + ### between ▸ **between**(`lower`, `upper`): [`Search`](Search.md)<`TEntity`\> @@ -156,8 +211,8 @@ Adds an inclusive range comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `lower` | `number` | The lower bound of the range. | -| `upper` | `number` | The upper bound of the range. | +| `lower` | `string` \| `number` \| `Date` | The lower bound of the range. | +| `upper` | `string` \| `number` \| `Date` | The upper bound of the range. | #### Returns @@ -167,7 +222,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:162](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L162) +[lib/search/where-field.ts:175](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L175) ___ @@ -175,7 +230,7 @@ ___ ▸ **contain**(`value`): [`Search`](Search.md)<`TEntity`\> -Adds a whole-string match for a value within an array to the search query. +Adds a whole-string match for a value within a string array to the search query. #### Parameters @@ -191,7 +246,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:169](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L169) +[lib/search/where-field.ts:182](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L182) ___ @@ -199,7 +254,7 @@ ___ ▸ **containOneOf**(...`value`): [`Search`](Search.md)<`TEntity`\> -Adds a whole-string match against an array to the query. If any of the provided +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 @@ -216,7 +271,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:184](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L184) +[lib/search/where-field.ts:197](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L197) ___ @@ -224,7 +279,7 @@ ___ ▸ **contains**(`value`): [`Search`](Search.md)<`TEntity`\> -Adds a whole-string match for a value within an array to the search query. +Adds a whole-string match for a value within a string array to the search query. #### Parameters @@ -240,7 +295,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:176](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L176) +[lib/search/where-field.ts:189](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L189) ___ @@ -248,7 +303,7 @@ ___ ▸ **containsOneOf**(...`value`): [`Search`](Search.md)<`TEntity`\> -Adds a whole-string match against an array to the query. If any of the provided +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 @@ -265,7 +320,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:192](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L192) +[lib/search/where-field.ts:205](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L205) ___ @@ -275,11 +330,14 @@ ___ 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` | The value to be compared | +| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | #### Returns @@ -289,7 +347,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:16](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L16) +[lib/search/where-field.ts:20](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L20) ___ @@ -299,11 +357,14 @@ ___ 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` | The value to be compared | +| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | #### Returns @@ -313,7 +374,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:23](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L23) +[lib/search/where-field.ts:30](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L30) ___ @@ -323,11 +384,14 @@ ___ 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` | The value to be compared | +| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | #### Returns @@ -337,7 +401,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:37](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L37) +[lib/search/where-field.ts:50](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L50) ___ @@ -347,11 +411,14 @@ ___ 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` | The value to be compared | +| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | #### Returns @@ -361,7 +428,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:30](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L30) +[lib/search/where-field.ts:40](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L40) ___ @@ -379,7 +446,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:98](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L98) +[lib/search/where-field.ts:111](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L111) ___ @@ -393,7 +460,7 @@ Adds a greater than comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -403,7 +470,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:112](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L112) +[lib/search/where-field.ts:125](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L125) ___ @@ -417,7 +484,7 @@ Adds a greater than or equal to comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -427,7 +494,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:126](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L126) +[lib/search/where-field.ts:139](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L139) ___ @@ -441,7 +508,7 @@ Adds a greater than comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -451,7 +518,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:105](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L105) +[lib/search/where-field.ts:118](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L118) ___ @@ -465,7 +532,31 @@ Adds a greater than or equal to comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | + +#### Returns + +[`Search`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:132](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L132) + +___ + +### inCircle + +▸ **inCircle**(`circleFn`): [`Search`](Search.md)<`TEntity`\> + +Adds a search for points that fall within a defined circle. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `circleFn` | [`CircleFunction`](../README.md#circlefunction) | A function that returns a [Circle](Circle.md) instance defining the search area. | #### Returns @@ -475,7 +566,31 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:119](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L119) +[lib/search/where-field.ts:212](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L212) + +___ + +### inRadius + +▸ **inRadius**(`circleFn`): [`Search`](Search.md)<`TEntity`\> + +Adds a search for points that fall within a defined radius. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `circleFn` | [`CircleFunction`](../README.md#circlefunction) | A function that returns a [Circle](Circle.md) instance defining the search area. | + +#### Returns + +[`Search`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:219](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L219) ___ @@ -489,7 +604,7 @@ Adds a less than comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -499,7 +614,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:140](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L140) +[lib/search/where-field.ts:153](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L153) ___ @@ -513,7 +628,7 @@ Adds a less than or equal to comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -523,7 +638,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:154](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L154) +[lib/search/where-field.ts:167](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L167) ___ @@ -537,7 +652,7 @@ Adds a less than comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -547,7 +662,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:133](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L133) +[lib/search/where-field.ts:146](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L146) ___ @@ -561,7 +676,7 @@ Adds a less than or equal to comparison against a field to the search query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `number` | The number to compare against. | +| `value` | `string` \| `number` \| `Date` | The value to compare against. | #### Returns @@ -571,7 +686,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:147](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L147) +[lib/search/where-field.ts:160](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L160) ___ @@ -585,7 +700,7 @@ Adds a full-text search comparison to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `string` | The word or phrase sought. | +| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | #### Returns @@ -595,7 +710,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:44](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L44) +[lib/search/where-field.ts:57](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L57) ___ @@ -609,7 +724,7 @@ Adds a full-text search comparison to the query that matches an exact word or ph | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `string` | The word or phrase sought. | +| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | #### Returns @@ -619,7 +734,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:58](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L58) +[lib/search/where-field.ts:71](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L71) ___ @@ -633,7 +748,7 @@ Adds a full-text search comparison to the query that matches an exact word or ph | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `string` | The word or phrase sought. | +| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | #### Returns @@ -643,7 +758,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:65](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L65) +[lib/search/where-field.ts:78](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L78) ___ @@ -657,7 +772,7 @@ Adds a full-text search comparison to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `string` | The word or phrase sought. | +| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | #### Returns @@ -667,7 +782,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:51](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L51) +[lib/search/where-field.ts:64](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L64) ___ @@ -681,7 +796,79 @@ Adds a full-text search comparison to the query that matches an exact word or ph | Name | Type | Description | | :------ | :------ | :------ | -| `value` | `string` | The word or phrase sought. | +| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | + +#### Returns + +[`Search`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:85](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L85) + +___ + +### on + +▸ **on**(`value`): [`Search`](Search.md)<`TEntity`\> + +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`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:226](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L226) + +___ + +### onOrAfter + +▸ **onOrAfter**(`value`): [`Search`](Search.md)<`TEntity`\> + +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`](Search.md)<`TEntity`\> + +The [Search](Search.md) that was called to create this [WhereField](WhereField.md). + +#### Defined in + +[lib/search/where-field.ts:254](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L254) + +___ + +### onOrBefore + +▸ **onOrBefore**(`value`): [`Search`](Search.md)<`TEntity`\> + +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 @@ -691,7 +878,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:72](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L72) +[lib/search/where-field.ts:247](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L247) ___ @@ -711,7 +898,7 @@ Converts this [Where](Where.md) into a portion of a RediSearch query. #### Defined in -[lib/search/where-field.ts:241](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L241) +[lib/search/where-field.ts:303](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L303) ___ @@ -729,4 +916,4 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:92](https://github.com/redis/redis-om-node/blob/ee688a6/lib/search/where-field.ts#L92) +[lib/search/where-field.ts:105](https://github.com/redis/redis-om-node/blob/39d7998/lib/search/where-field.ts#L105) diff --git a/docs/interfaces/BooleanField.md b/docs/interfaces/BooleanField.md index b00c33c9..aecc4b3f 100644 --- a/docs/interfaces/BooleanField.md +++ b/docs/interfaces/BooleanField.md @@ -32,7 +32,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) ___ @@ -44,4 +44,4 @@ Yep. It's a boolean. #### Defined in -[lib/schema/schema-definitions.ts:36](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L36) +[lib/schema/schema-definitions.ts:47](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L47) diff --git a/docs/interfaces/DateField.md b/docs/interfaces/DateField.md new file mode 100644 index 00000000..5018f50c --- /dev/null +++ b/docs/interfaces/DateField.md @@ -0,0 +1,47 @@ +[redis-om](../README.md) / DateField + +# Interface: DateField + +A field representing a date/time. + +## Hierarchy + +- [`Field`](Field.md) + + ↳ **`DateField`** + +## Table of contents + +### Properties + +- [alias](DateField.md#alias) +- [type](DateField.md#type) + +## Properties + +### alias + +• `Optional` **alias**: `string` + +The default field name in Redis is the key name defined in the +[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. + +#### Inherited from + +[Field](Field.md).[alias](Field.md#alias) + +#### Defined in + +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) + +___ + +### type + +• **type**: ``"date"`` + +Yep. It's a date. + +#### Defined in + +[lib/schema/schema-definitions.ts:59](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L59) diff --git a/docs/interfaces/Field.md b/docs/interfaces/Field.md index 3427daac..afaed683 100644 --- a/docs/interfaces/Field.md +++ b/docs/interfaces/Field.md @@ -8,13 +8,19 @@ Base interface for all fields. - **`Field`** - ↳ [`NumericField`](NumericField.md) + ↳ [`BooleanField`](BooleanField.md) + + ↳ [`DateField`](DateField.md) + + ↳ [`NumberField`](NumberField.md) + + ↳ [`PointField`](PointField.md) ↳ [`StringField`](StringField.md) - ↳ [`BooleanField`](BooleanField.md) + ↳ [`StringArrayField`](StringArrayField.md) - ↳ [`ArrayField`](ArrayField.md) + ↳ [`TextField`](TextField.md) ## Table of contents @@ -33,4 +39,4 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) diff --git a/docs/interfaces/NumericField.md b/docs/interfaces/NumberField.md similarity index 54% rename from docs/interfaces/NumericField.md rename to docs/interfaces/NumberField.md index 0ae23a21..bf109124 100644 --- a/docs/interfaces/NumericField.md +++ b/docs/interfaces/NumberField.md @@ -1,6 +1,6 @@ -[redis-om](../README.md) / NumericField +[redis-om](../README.md) / NumberField -# Interface: NumericField +# Interface: NumberField A field representing a number. @@ -8,14 +8,14 @@ A field representing a number. - [`Field`](Field.md) - ↳ **`NumericField`** + ↳ **`NumberField`** ## Table of contents ### Properties -- [alias](NumericField.md#alias) -- [type](NumericField.md#type) +- [alias](NumberField.md#alias) +- [type](NumberField.md#type) ## Properties @@ -32,7 +32,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) ___ @@ -44,4 +44,4 @@ Yep. It's a number. #### Defined in -[lib/schema/schema-definitions.ts:13](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L13) +[lib/schema/schema-definitions.ts:21](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L21) diff --git a/docs/interfaces/PointField.md b/docs/interfaces/PointField.md new file mode 100644 index 00000000..18d316f6 --- /dev/null +++ b/docs/interfaces/PointField.md @@ -0,0 +1,47 @@ +[redis-om](../README.md) / PointField + +# Interface: PointField + +A field representing a point on the globe. + +## Hierarchy + +- [`Field`](Field.md) + + ↳ **`PointField`** + +## Table of contents + +### Properties + +- [alias](PointField.md#alias) +- [type](PointField.md#type) + +## Properties + +### alias + +• `Optional` **alias**: `string` + +The default field name in Redis is the key name defined in the +[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. + +#### Inherited from + +[Field](Field.md).[alias](Field.md#alias) + +#### Defined in + +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) + +___ + +### type + +• **type**: ``"point"`` + +Yep. It's a point. + +#### Defined in + +[lib/schema/schema-definitions.ts:53](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L53) diff --git a/docs/interfaces/ArrayField.md b/docs/interfaces/StringArrayField.md similarity index 50% rename from docs/interfaces/ArrayField.md rename to docs/interfaces/StringArrayField.md index b615c1c8..e30ad6b9 100644 --- a/docs/interfaces/ArrayField.md +++ b/docs/interfaces/StringArrayField.md @@ -1,6 +1,6 @@ -[redis-om](../README.md) / ArrayField +[redis-om](../README.md) / StringArrayField -# Interface: ArrayField +# Interface: StringArrayField A field representing an array of strings. @@ -8,15 +8,15 @@ A field representing an array of strings. - [`Field`](Field.md) - ↳ **`ArrayField`** + ↳ **`StringArrayField`** ## Table of contents ### Properties -- [alias](ArrayField.md#alias) -- [separator](ArrayField.md#separator) -- [type](ArrayField.md#type) +- [alias](StringArrayField.md#alias) +- [separator](StringArrayField.md#separator) +- [type](StringArrayField.md#type) ## Properties @@ -33,7 +33,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) ___ @@ -43,21 +43,21 @@ ___ Due to how RediSearch works, non-full-text 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 ArrayField contains this separator, this can cause problems. You can change it +array. If your StringArrayField contains this separator, this can cause problems. You can change it here to avoid those problems. Defaults to `|`. #### Defined in -[lib/schema/schema-definitions.ts:50](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L50) +[lib/schema/schema-definitions.ts:73](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L73) ___ ### type -• **type**: ``"array"`` +• **type**: ``"string[]"`` -Yep. It's an array. +Yep. It's a string array. #### Defined in -[lib/schema/schema-definitions.ts:42](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L42) +[lib/schema/schema-definitions.ts:65](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L65) diff --git a/docs/interfaces/StringField.md b/docs/interfaces/StringField.md index 58ef6f1f..ddad4667 100644 --- a/docs/interfaces/StringField.md +++ b/docs/interfaces/StringField.md @@ -2,7 +2,7 @@ # Interface: StringField -A field representing a string. +A field representing a whole string. ## Hierarchy @@ -16,7 +16,6 @@ A field representing a string. - [alias](StringField.md#alias) - [separator](StringField.md#separator) -- [textSearch](StringField.md#textsearch) - [type](StringField.md#type) ## Properties @@ -34,7 +33,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) ___ @@ -42,26 +41,14 @@ ___ • `Optional` **separator**: `string` -Due to how RediSearch works, non-full-text 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 `|`. +Due 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 `|`. #### Defined in -[lib/schema/schema-definitions.ts:30](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L30) - -___ - -### textSearch - -• `Optional` **textSearch**: `boolean` - -Enables full-text search on this field when set to `true`. Defaults to `false`. - -#### Defined in - -[lib/schema/schema-definitions.ts:22](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L22) +[lib/schema/schema-definitions.ts:35](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L35) ___ @@ -73,4 +60,4 @@ Yep. It's a string. #### Defined in -[lib/schema/schema-definitions.ts:19](https://github.com/redis/redis-om-node/blob/ee688a6/lib/schema/schema-definitions.ts#L19) +[lib/schema/schema-definitions.ts:27](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L27) diff --git a/docs/interfaces/TextField.md b/docs/interfaces/TextField.md new file mode 100644 index 00000000..e70871a3 --- /dev/null +++ b/docs/interfaces/TextField.md @@ -0,0 +1,47 @@ +[redis-om](../README.md) / TextField + +# Interface: TextField + +A field representing searchable text. + +## Hierarchy + +- [`Field`](Field.md) + + ↳ **`TextField`** + +## Table of contents + +### Properties + +- [alias](TextField.md#alias) +- [type](TextField.md#type) + +## Properties + +### alias + +• `Optional` **alias**: `string` + +The default field name in Redis is the key name defined in the +[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. + +#### Inherited from + +[Field](Field.md).[alias](Field.md#alias) + +#### Defined in + +[lib/schema/schema-definitions.ts:15](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L15) + +___ + +### type + +• **type**: ``"text"`` + +Yep. It's searchable text. + +#### Defined in + +[lib/schema/schema-definitions.ts:41](https://github.com/redis/redis-om-node/blob/39d7998/lib/schema/schema-definitions.ts#L41)