Skip to content

Commit 54b3e17

Browse files
sjpotterleibale
andauthored
add addscores to aggregate search command (#2799)
* add addscores to aggregate search command * change `true` to `boolean` --------- Co-authored-by: Leibale Eidelman <[email protected]>
1 parent 6f79b49 commit 54b3e17

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ describe('AGGREGATE', () => {
1919
);
2020
});
2121

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

packages/search/lib/commands/AGGREGATE.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ type LoadField = PropertyName | {
119119
}
120120

121121
export interface AggregateOptions {
122-
VERBATIM?: true;
122+
VERBATIM?: boolean;
123+
ADDSCORES?: boolean;
123124
LOAD?: LoadField | Array<LoadField>;
124125
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
125126
PARAMS?: Params;
@@ -150,6 +151,10 @@ export function pushAggregatehOptions(
150151
args.push('VERBATIM');
151152
}
152153

154+
if (options?.ADDSCORES) {
155+
args.push('ADDSCORES');
156+
}
157+
153158
if (options?.LOAD) {
154159
args.push('LOAD');
155160
pushArgumentsWithLength(args, () => {
@@ -308,4 +313,4 @@ export function transformReply(rawReply: AggregateRawReply): AggregateReply {
308313
total: rawReply[0],
309314
results
310315
};
311-
}
316+
}

0 commit comments

Comments
 (0)