Skip to content

Commit a4164e8

Browse files
authored
Merge 2a2002e into 3273c85
2 parents 3273c85 + 2a2002e commit a4164e8

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

packages/search/lib/commands/AGGREGATE.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@ describe('AGGREGATE', () => {
454454
['FT.AGGREGATE', 'index', '*', 'DIALECT', '1']
455455
);
456456
});
457+
458+
it('with TIMEOUT', () => {
459+
assert.deepEqual(
460+
transformArguments('index', '*', { TIMEOUT: 10 }),
461+
['FT.AGGREGATE', 'index', '*', 'TIMEOUT', '10']
462+
);
463+
});
457464
});
458465

459466
testUtils.testWithClient('client.ft.aggregate', async client => {

packages/search/lib/commands/AGGREGATE.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export interface AggregateOptions {
124124
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
125125
PARAMS?: Params;
126126
DIALECT?: number;
127+
TIMEOUT?: number;
127128
}
128129

129130
export const FIRST_KEY_INDEX = 1;
@@ -213,6 +214,10 @@ export function pushAggregatehOptions(
213214
args.push('DIALECT', options.DIALECT.toString());
214215
}
215216

217+
if (options?.TIMEOUT !== undefined) {
218+
args.push('TIMEOUT', options.TIMEOUT.toString());
219+
}
220+
216221
return args;
217222
}
218223

packages/search/lib/commands/SEARCH.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ describe('SEARCH', () => {
233233
['FT.SEARCH', 'index', 'query', 'DIALECT', '1']
234234
);
235235
});
236+
237+
it('with TIMEOUT', () => {
238+
assert.deepEqual(
239+
transformArguments('index', 'query', {
240+
TIMEOUT: 5
241+
}),
242+
['FT.SEARCH', 'index', 'query', 'TIMEOUT', '5']
243+
);
244+
});
236245
});
237246

238247
describe('client.ft.search', () => {

packages/search/lib/commands/SEARCH.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export interface SearchOptions {
5555
};
5656
PARAMS?: Params;
5757
DIALECT?: number;
58+
TIMEOUT?: number;
5859
}
5960

6061
export function transformArguments(

packages/search/lib/commands/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,10 @@ export function pushSearchOptions(
510510
args.preserve = true;
511511
}
512512

513+
if (options?.TIMEOUT !== undefined) {
514+
args.push('TIMEOUT', options.TIMEOUT.toString());
515+
}
516+
513517
return args;
514518
}
515519

0 commit comments

Comments
 (0)