diff --git a/packages/search/lib/commands/SEARCH.spec.ts b/packages/search/lib/commands/SEARCH.spec.ts index 18c3e7d737..a4d75dd895 100644 --- a/packages/search/lib/commands/SEARCH.spec.ts +++ b/packages/search/lib/commands/SEARCH.spec.ts @@ -199,7 +199,7 @@ describe('SEARCH', () => { it('with SORTBY', () => { assert.deepEqual( transformArguments('index', 'query', { SORTBY: '@by' }), - ['FT.SEARCH', 'index', 'query', 'SORTBY', '1', '@by'] + ['FT.SEARCH', 'index', 'query', 'SORTBY', '@by'] ); }); diff --git a/packages/search/lib/commands/SEARCH.ts b/packages/search/lib/commands/SEARCH.ts index 3347e3751b..0202d41de8 100644 --- a/packages/search/lib/commands/SEARCH.ts +++ b/packages/search/lib/commands/SEARCH.ts @@ -1,6 +1,6 @@ import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { pushOptionalVerdictArgument, pushVerdictArgument, transformReplyTuples } from '@node-redis/client/dist/lib/commands/generic-transformers'; -import { RedisSearchLanguages, PropertyName, pushSortByArguments, SortByOptions } from '.'; +import { RedisSearchLanguages, PropertyName, pushSortByProperty, SortByOptions } from '.'; export const FIRST_KEY_INDEX = 1; @@ -150,7 +150,8 @@ export function transformArguments( // } if (options?.SORTBY) { - pushSortByArguments(args, 'SORTBY', options.SORTBY); + args.push('SORTBY'); + pushSortByProperty(args, options.SORTBY); } // if (options?.MSORTBY) {