You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +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:
@@ -19,6 +19,13 @@ describe('AGGREGATE', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('with ADDSCORES', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('index', '*', { ADDSCORES: true }),
|
||||||
|
['FT.AGGREGATE', 'index', '*', 'ADDSCORES']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe('with LOAD', () => {
|
describe('with LOAD', () => {
|
||||||
describe('single', () => {
|
describe('single', () => {
|
||||||
describe('without alias', () => {
|
describe('without alias', () => {
|
||||||
|
@@ -119,7 +119,8 @@ type LoadField = PropertyName | {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AggregateOptions {
|
export interface AggregateOptions {
|
||||||
VERBATIM?: true;
|
VERBATIM?: boolean;
|
||||||
|
ADDSCORES?: boolean;
|
||||||
LOAD?: LoadField | Array<LoadField>;
|
LOAD?: LoadField | Array<LoadField>;
|
||||||
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
|
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
|
||||||
PARAMS?: Params;
|
PARAMS?: Params;
|
||||||
@@ -150,6 +151,10 @@ export function pushAggregatehOptions(
|
|||||||
args.push('VERBATIM');
|
args.push('VERBATIM');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options?.ADDSCORES) {
|
||||||
|
args.push('ADDSCORES');
|
||||||
|
}
|
||||||
|
|
||||||
if (options?.LOAD) {
|
if (options?.LOAD) {
|
||||||
args.push('LOAD');
|
args.push('LOAD');
|
||||||
pushArgumentsWithLength(args, () => {
|
pushArgumentsWithLength(args, () => {
|
||||||
@@ -308,4 +313,4 @@ export function transformReply(rawReply: AggregateRawReply): AggregateReply {
|
|||||||
total: rawReply[0],
|
total: rawReply[0],
|
||||||
results
|
results
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user