diff --git a/packages/search/lib/commands/AGGREGATE.spec.ts b/packages/search/lib/commands/AGGREGATE.spec.ts index d1e4565339..5b34d7dc16 100644 --- a/packages/search/lib/commands/AGGREGATE.spec.ts +++ b/packages/search/lib/commands/AGGREGATE.spec.ts @@ -19,6 +19,13 @@ describe('AGGREGATE', () => { ); }); + it('with ADDSCORES', () => { + assert.deepEqual( + transformArguments('index', '*', { ADDSCORES: true }), + ['FT.AGGREGATE', 'index', '*', 'ADDSCORES'] + ); + }); + describe('with LOAD', () => { describe('single', () => { describe('without alias', () => { diff --git a/packages/search/lib/commands/AGGREGATE.ts b/packages/search/lib/commands/AGGREGATE.ts index 950d959243..0cab9b25d4 100644 --- a/packages/search/lib/commands/AGGREGATE.ts +++ b/packages/search/lib/commands/AGGREGATE.ts @@ -119,7 +119,8 @@ type LoadField = PropertyName | { } export interface AggregateOptions { - VERBATIM?: true; + VERBATIM?: boolean; + ADDSCORES?: boolean; LOAD?: LoadField | Array; STEPS?: Array; PARAMS?: Params; @@ -150,6 +151,10 @@ export function pushAggregatehOptions( args.push('VERBATIM'); } + if (options?.ADDSCORES) { + args.push('ADDSCORES'); + } + if (options?.LOAD) { args.push('LOAD'); pushArgumentsWithLength(args, () => { @@ -308,4 +313,4 @@ export function transformReply(rawReply: AggregateRawReply): AggregateReply { total: rawReply[0], results }; -} \ No newline at end of file +}