diff --git a/packages/search/lib/commands/AGGREGATE.spec.ts b/packages/search/lib/commands/AGGREGATE.spec.ts index a2330076438..d1e4565339a 100644 --- a/packages/search/lib/commands/AGGREGATE.spec.ts +++ b/packages/search/lib/commands/AGGREGATE.spec.ts @@ -454,6 +454,13 @@ describe('AGGREGATE', () => { ['FT.AGGREGATE', 'index', '*', 'DIALECT', '1'] ); }); + + it('with TIMEOUT', () => { + assert.deepEqual( + transformArguments('index', '*', { TIMEOUT: 10 }), + ['FT.AGGREGATE', 'index', '*', 'TIMEOUT', '10'] + ); + }); }); testUtils.testWithClient('client.ft.aggregate', async client => { diff --git a/packages/search/lib/commands/AGGREGATE.ts b/packages/search/lib/commands/AGGREGATE.ts index c32d20b0b1c..950d959243a 100644 --- a/packages/search/lib/commands/AGGREGATE.ts +++ b/packages/search/lib/commands/AGGREGATE.ts @@ -124,6 +124,7 @@ export interface AggregateOptions { STEPS?: Array; PARAMS?: Params; DIALECT?: number; + TIMEOUT?: number; } export const FIRST_KEY_INDEX = 1; @@ -213,6 +214,10 @@ export function pushAggregatehOptions( args.push('DIALECT', options.DIALECT.toString()); } + if (options?.TIMEOUT !== undefined) { + args.push('TIMEOUT', options.TIMEOUT.toString()); + } + return args; } diff --git a/packages/search/lib/commands/SEARCH.spec.ts b/packages/search/lib/commands/SEARCH.spec.ts index 47c82cf892b..931458b3a25 100644 --- a/packages/search/lib/commands/SEARCH.spec.ts +++ b/packages/search/lib/commands/SEARCH.spec.ts @@ -233,6 +233,15 @@ describe('SEARCH', () => { ['FT.SEARCH', 'index', 'query', 'DIALECT', '1'] ); }); + + it('with TIMEOUT', () => { + assert.deepEqual( + transformArguments('index', 'query', { + TIMEOUT: 5 + }), + ['FT.SEARCH', 'index', 'query', 'TIMEOUT', '5'] + ); + }); }); describe('client.ft.search', () => { diff --git a/packages/search/lib/commands/SEARCH.ts b/packages/search/lib/commands/SEARCH.ts index fbccb25058b..ef6c0d5c2d1 100644 --- a/packages/search/lib/commands/SEARCH.ts +++ b/packages/search/lib/commands/SEARCH.ts @@ -55,6 +55,7 @@ export interface SearchOptions { }; PARAMS?: Params; DIALECT?: number; + TIMEOUT?: number; } export function transformArguments( diff --git a/packages/search/lib/commands/index.ts b/packages/search/lib/commands/index.ts index d56db7bdbbe..0470aff213f 100644 --- a/packages/search/lib/commands/index.ts +++ b/packages/search/lib/commands/index.ts @@ -510,6 +510,10 @@ export function pushSearchOptions( args.preserve = true; } + if (options?.TIMEOUT !== undefined) { + args.push('TIMEOUT', options.TIMEOUT.toString()); + } + return args; }