1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

add addscores to aggregate search command (#2799)

* add addscores to aggregate search command

* change `true` to `boolean`

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
Shaya Potter
2024-07-29 16:22:38 +03:00
committed by GitHub
parent 6f79b49f73
commit 54b3e178f9
2 changed files with 14 additions and 2 deletions

View File

@@ -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', () => {

View File

@@ -119,7 +119,8 @@ type LoadField = PropertyName | {
}
export interface AggregateOptions {
VERBATIM?: true;
VERBATIM?: boolean;
ADDSCORES?: boolean;
LOAD?: LoadField | Array<LoadField>;
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
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
};
}
}