Skip to content

Commit 2eaaa58

Browse files
authored
add addscores to aggregate search command (v5) (#2818)
1 parent f7d824c commit 2eaaa58

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ describe('AGGREGATE', () => {
2020
);
2121
});
2222

23+
it('with ADDSCORES', () => {
24+
assert.deepEqual(
25+
AGGREGATE.transformArguments('index', '*', { ADDSCORES: true }),
26+
['FT.AGGREGATE', 'index', '*', 'ADDSCORES']
27+
);
28+
});
29+
2330
describe('with LOAD', () => {
2431
describe('single', () => {
2532
describe('without alias', () => {

packages/search/lib/commands/AGGREGATE.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ interface FilterStep extends AggregateStep<FT_AGGREGATE_STEPS['FILTER']> {
118118

119119
export interface FtAggregateOptions {
120120
VERBATIM?: boolean;
121+
ADDSCORES?: boolean;
121122
LOAD?: LoadField | Array<LoadField>;
122123
TIMEOUT?: number;
123124
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
@@ -135,6 +136,10 @@ export default {
135136
args.push('VERBATIM');
136137
}
137138

139+
if (options?.ADDSCORES) {
140+
args.push('ADDSCORES');
141+
}
142+
138143
if (options?.LOAD) {
139144
const length = args.push('LOAD', '');
140145

0 commit comments

Comments
 (0)