redis-om / RawSearch
Entry point to raw search which allows using raw RediSearch queries against Redis OM. Requires that RediSearch (and optionally RedisJSON) be installed.
template
The type of Entity being sought.
-
↳
RawSearch
- all
- allIds
- allKeys
- count
- first
- firstId
- firstKey
- max
- maxId
- maxKey
- min
- minId
- minKey
- page
- pageOfIds
- pageOfKeys
- returnAll
- returnAllIds
- returnAllKeys
- returnCount
- returnFirst
- returnFirstId
- returnFirstKey
- returnMax
- returnMaxId
- returnMaxKey
- returnMin
- returnMinId
- returnMinKey
- returnPage
- returnPageOfIds
- returnPageOfKeys
- sortAsc
- sortAscending
- sortBy
- sortDesc
- sortDescending
• get
return(): AbstractSearch
Returns the current instance. Syntactic sugar to make your code more fluent.
this
AbstractSearch.return
▸ all(options?
): Promise
<Entity
[]>
Returns all the Entities that match this query. This method
makes multiple calls to Redis until all the Entities are returned.
You can specify the batch size by setting the pageSize
property on the
options:
const entities = await repository.search().returnAll({ pageSize: 100 })
Name | Type | Default value | Description |
---|---|---|---|
options |
Object |
undefined |
Options for the call. |
options.pageSize |
number |
10 |
Number of Entities returned per batch. |
Promise
<Entity
[]>
An array of Entities matching the query.
▸ allIds(options?
): Promise
<string
[]>
Returns all the entity IDs that match this query. This method
makes multiple calls to Redis until all the entity IDs are returned.
You can specify the batch size by setting the pageSize
property on the
options:
const keys = await repository.search().returnAllIds({ pageSize: 100 })
Name | Type | Default value | Description |
---|---|---|---|
options |
Object |
undefined |
Options for the call. |
options.pageSize |
number |
10 |
Number of entity IDs returned per batch. |
Promise
<string
[]>
An array of entity IDs matching the query.
▸ allKeys(options?
): Promise
<string
[]>
Returns all the key names in Redis that match this query. This method
makes multiple calls to Redis until all the key names are returned.
You can specify the batch size by setting the pageSize
property on the
options:
const keys = await repository.search().returnAllKeys({ pageSize: 100 })
Name | Type | Default value | Description |
---|---|---|---|
options |
Object |
undefined |
Options for the call. |
options.pageSize |
number |
10 |
Number of key names returned per batch. |
Promise
<string
[]>
An array of key names matching the query.
▸ count(): Promise
<number
>
Returns the number of Entities that match this query.
Promise
<number
>
▸ first(): Promise
<null
| Entity
>
Returns the first Entity that matches this query.
Promise
<null
| Entity
>
▸ firstId(): Promise
<null
| string
>
Returns the first entity ID that matches this query.
Promise
<null
| string
>
▸ firstKey(): Promise
<null
| string
>
Returns the first key name that matches this query.
Promise
<null
| string
>
▸ max(field
): Promise
<null
| Entity
>
Finds the Entity with the maximal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the maximal value. |
Promise
<null
| Entity
>
The entity ID Entity with the maximal value
▸ maxId(field
): Promise
<null
| string
>
Finds the entity ID with the maximal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the maximal value. |
Promise
<null
| string
>
The entity ID with the maximal value
▸ maxKey(field
): Promise
<null
| string
>
Finds the key name in Redis with the maximal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the maximal value. |
Promise
<null
| string
>
The key name with the maximal value
▸ min(field
): Promise
<null
| Entity
>
Finds the Entity with the minimal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the minimal value. |
Promise
<null
| Entity
>
The Entity with the minimal value
▸ minId(field
): Promise
<null
| string
>
Finds the entity ID with the minimal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the minimal value. |
Promise
<null
| string
>
The entity ID with the minimal value
▸ minKey(field
): Promise
<null
| string
>
Finds the key name in Redis with the minimal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the minimal value. |
Promise
<null
| string
>
The key name with the minimal value
▸ page(offset
, count
): Promise
<Entity
[]>
Returns a page of Entities that match this query.
Name | Type | Description |
---|---|---|
offset |
number |
The offset for where to start returning Entities. |
count |
number |
The number of Entities to return. |
Promise
<Entity
[]>
An array of Entities matching the query.
▸ pageOfIds(offset
, count
): Promise
<string
[]>
Returns a page of entity IDs that match this query.
Name | Type | Description |
---|---|---|
offset |
number |
The offset for where to start returning entity IDs. |
count |
number |
The number of entity IDs to return. |
Promise
<string
[]>
An array of strings matching the query.
▸ pageOfKeys(offset
, count
): Promise
<string
[]>
Returns a page of key names in Redis that match this query.
Name | Type | Description |
---|---|---|
offset |
number |
The offset for where to start returning key names. |
count |
number |
The number of key names to return. |
Promise
<string
[]>
An array of strings matching the query.
▸ returnAll(options?
): Promise
<Entity
[]>
Alias for all.
Name | Type | Default value |
---|---|---|
options |
Object |
undefined |
options.pageSize |
number |
10 |
Promise
<Entity
[]>
▸ returnAllIds(options?
): Promise
<string
[]>
Alias for allIds.
Name | Type | Default value |
---|---|---|
options |
Object |
undefined |
options.pageSize |
number |
10 |
Promise
<string
[]>
▸ returnAllKeys(options?
): Promise
<string
[]>
Alias for allKeys.
Name | Type | Default value |
---|---|---|
options |
Object |
undefined |
options.pageSize |
number |
10 |
Promise
<string
[]>
▸ returnCount(): Promise
<number
>
Alias for count.
Promise
<number
>
▸ returnFirst(): Promise
<null
| Entity
>
Alias for first.
Promise
<null
| Entity
>
▸ returnFirstId(): Promise
<null
| string
>
Alias for firstId.
Promise
<null
| string
>
▸ returnFirstKey(): Promise
<null
| string
>
Alias for firstKey.
Promise
<null
| string
>
▸ returnMax(field
): Promise
<null
| Entity
>
Alias for max.
Name | Type |
---|---|
field |
string |
Promise
<null
| Entity
>
▸ returnMaxId(field
): Promise
<null
| string
>
Alias for maxId.
Name | Type |
---|---|
field |
string |
Promise
<null
| string
>
▸ returnMaxKey(field
): Promise
<null
| string
>
Alias for maxKey.
Name | Type |
---|---|
field |
string |
Promise
<null
| string
>
▸ returnMin(field
): Promise
<null
| Entity
>
Alias for min.
Name | Type |
---|---|
field |
string |
Promise
<null
| Entity
>
▸ returnMinId(field
): Promise
<null
| string
>
Alias for minId.
Name | Type |
---|---|
field |
string |
Promise
<null
| string
>
▸ returnMinKey(field
): Promise
<null
| string
>
Alias for minKey.
Name | Type |
---|---|
field |
string |
Promise
<null
| string
>
▸ returnPage(offset
, count
): Promise
<Entity
[]>
Alias for page.
Name | Type |
---|---|
offset |
number |
count |
number |
Promise
<Entity
[]>
▸ returnPageOfIds(offset
, count
): Promise
<string
[]>
Alias for pageOfIds.
Name | Type |
---|---|
offset |
number |
count |
number |
Promise
<string
[]>
AbstractSearch.returnPageOfIds
▸ returnPageOfKeys(offset
, count
): Promise
<string
[]>
Alias for pageOfKeys.
Name | Type |
---|---|
offset |
number |
count |
number |
Promise
<string
[]>
AbstractSearch.returnPageOfKeys
▸ sortAsc(field
): AbstractSearch
Alias for sortAscending.
Name | Type |
---|---|
field |
string |
▸ sortAscending(field
): AbstractSearch
Applies an ascending sort to the query.
Name | Type | Description |
---|---|---|
field |
string |
The field to sort by. |
this
▸ sortBy(fieldName
, order?
): AbstractSearch
Applies sorting for the query.
Name | Type | Default value | Description |
---|---|---|---|
fieldName |
string |
undefined |
- |
order |
"ASC" | "DESC" |
'ASC' |
The order of returned Entities Defaults to ASC (ascending) if not specified |
this
▸ sortDesc(field
): AbstractSearch
Alias for sortDescending.
Name | Type |
---|---|
field |
string |
▸ sortDescending(field
): AbstractSearch
Applies a descending sort to the query.
Name | Type | Description |
---|---|---|
field |
string |
The field to sort by. |
this