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.
Name | Type | Description |
---|---|---|
TEntity |
extends Entity |
The type of Entity being sought. |
-
AbstractSearch
<TEntity
>↳
RawSearch
- all
- count
- first
- max
- min
- page
- returnAll
- returnCount
- returnFirst
- returnMax
- returnMin
- returnPage
- sortAsc
- sortAscending
- sortBy
- sortDesc
- sortDescending
• get
return(): AbstractSearch
<TEntity
>
Returns the current instance. Syntactic sugar to make your code more fluent.
AbstractSearch
<TEntity
>
this
AbstractSearch.return
▸ all(options?
): Promise
<TEntity
[]>
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:
let 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
<TEntity
[]>
An array of Entities matching the query.
▸ count(): Promise
<number
>
Returns the number of Entities that match this query.
Promise
<number
>
▸ first(): Promise
<TEntity
>
Returns only the first Entity that matches this query.
Promise
<TEntity
>
▸ max(field
): Promise
<TEntity
>
Finds the Entity with the maximal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the maximal value. |
Promise
<TEntity
>
The Entity with the maximal value
▸ min(field
): Promise
<TEntity
>
Finds the Entity with the minimal value for a field.
Name | Type | Description |
---|---|---|
field |
string |
The field with the minimal value. |
Promise
<TEntity
>
The Entity with the minimal value
▸ page(offset
, count
): Promise
<TEntity
[]>
Returns a page of Entities that match this query.
Name | Type | Description |
---|---|---|
offset |
number |
The offset for where to start returning Entities. |
count |
number |
- |
Promise
<TEntity
[]>
An array of Entities matching the query.
▸ returnAll(options?
): Promise
<TEntity
[]>
Alias for Search.all.
Name | Type | Default value |
---|---|---|
options |
Object |
undefined |
options.pageSize |
number |
10 |
Promise
<TEntity
[]>
▸ returnCount(): Promise
<number
>
Alias for Search.count.
Promise
<number
>
▸ returnFirst(): Promise
<TEntity
>
Alias for Search.first.
Promise
<TEntity
>
▸ returnMax(field
): Promise
<TEntity
>
Alias for Search.max.
Name | Type |
---|---|
field |
string |
Promise
<TEntity
>
▸ returnMin(field
): Promise
<TEntity
>
Alias for Search.min.
Name | Type |
---|---|
field |
string |
Promise
<TEntity
>
▸ returnPage(offset
, count
): Promise
<TEntity
[]>
Alias for Search.page.
Name | Type |
---|---|
offset |
number |
count |
number |
Promise
<TEntity
[]>
▸ sortAsc(field
): AbstractSearch
<TEntity
>
Alias for Search.sortAscending.
Name | Type |
---|---|
field |
string |
AbstractSearch
<TEntity
>
▸ sortAscending(field
): AbstractSearch
<TEntity
>
Applies an ascending sort to the query.
Name | Type | Description |
---|---|---|
field |
string |
The field to sort by. |
AbstractSearch
<TEntity
>
this
▸ sortBy(field
, order?
): AbstractSearch
<TEntity
>
Applies sorting for the query.
Name | Type | Default value | Description |
---|---|---|---|
field |
string |
undefined |
The field to sort by. |
order |
"ASC" | "DESC" |
'ASC' |
The order of returned Entities Defaults to ASC (ascending) if not specified |
AbstractSearch
<TEntity
>
this
▸ sortDesc(field
): AbstractSearch
<TEntity
>
Alias for Search.sortDescending.
Name | Type |
---|---|
field |
string |
AbstractSearch
<TEntity
>
▸ sortDescending(field
): AbstractSearch
<TEntity
>
Applies a descending sort to the query.
Name | Type | Description |
---|---|---|
field |
string |
The field to sort by. |
AbstractSearch
<TEntity
>
this