Skip to content

Commit cba0289

Browse files
committed
fix FT.SEARCH
1 parent 70872d8 commit cba0289

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/search/lib/commands/AGGREGATE.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
22
import { pushVerdictArgument, transformReplyTuples, TuplesObject } from '@node-redis/client/dist/lib/commands/generic-transformers';
3-
import { PropertyName, pushArgumentsWithLength, pushSortByArguments, SortByOptions } from '.';
3+
import { PropertyName, pushArgumentsWithLength, pushSortByArguments, SortByProperty } from '.';
44

55
export enum AggregateSteps {
66
GROUPBY = 'GROUPBY',
@@ -95,7 +95,7 @@ interface GroupByStep extends AggregateStep<AggregateSteps.GROUPBY> {
9595
}
9696

9797
interface SortStep extends AggregateStep<AggregateSteps.SORTBY> {
98-
BY: SortByOptions | Array<SortByOptions>;
98+
BY: SortByProperty | Array<SortByProperty>;
9999
MAX?: number;
100100
}
101101

packages/search/lib/commands/SEARCH.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
22
import { pushOptionalVerdictArgument, pushVerdictArgument, transformReplyTuples } from '@node-redis/client/dist/lib/commands/generic-transformers';
3-
import { RedisSearchLanguages, PropertyName, pushSortByProperty, SortByOptions } from '.';
3+
import { RedisSearchLanguages, PropertyName, pushSortByProperty, SortByProperty } from '.';
44

55
export const FIRST_KEY_INDEX = 1;
66

@@ -48,8 +48,8 @@ interface SearchOptions {
4848
SCORER?: string;
4949
// EXPLAINSCORE?: true; // TODO: WITHSCORES
5050
// PAYLOAD?: ;
51-
SORTBY?: SortByOptions;
52-
// MSORTBY?: SortByOptions | Array<SortByOptions>;
51+
SORTBY?: SortByProperty;
52+
// MSORTBY?: SortByProperty | Array<SortByProperty>;
5353
LIMIT?: {
5454
from: number | string;
5555
size: number | string;

packages/search/lib/commands/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ export enum RedisSearchLanguages {
117117

118118
export type PropertyName = `${'@' | '$.'}${string}`;
119119

120-
export type SortByOptions = PropertyName | {
120+
export type SortByProperty = PropertyName | {
121121
BY: PropertyName;
122122
DIRECTION?: 'ASC' | 'DESC';
123123
};
124124

125-
function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByOptions): void {
125+
export function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByProperty): void {
126126
if (typeof sortBy === 'string') {
127127
args.push(sortBy);
128128
} else {
@@ -134,7 +134,7 @@ function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByOptions):
134134
}
135135
}
136136

137-
export function pushSortByArguments(args: RedisCommandArguments, name: string, sortBy: SortByOptions | Array<SortByOptions>): RedisCommandArguments {
137+
export function pushSortByArguments(args: RedisCommandArguments, name: string, sortBy: SortByProperty | Array<SortByProperty>): RedisCommandArguments {
138138
const lengthBefore = args.push(
139139
name,
140140
'' // will be overwritten

0 commit comments

Comments
 (0)