diff --git a/packages/search/lib/commands/SEARCH.spec.ts b/packages/search/lib/commands/SEARCH.spec.ts index 931458b3a25..f1064dec784 100644 --- a/packages/search/lib/commands/SEARCH.spec.ts +++ b/packages/search/lib/commands/SEARCH.spec.ts @@ -215,6 +215,12 @@ describe('SEARCH', () => { }); it('with PARAMS', () => { + assert.deepEqual( + transformArguments('index', 'query', { + PARAMS: {} + }), + ['FT.SEARCH', 'index', 'query'] + ); assert.deepEqual( transformArguments('index', 'query', { PARAMS: { diff --git a/packages/search/lib/commands/index.ts b/packages/search/lib/commands/index.ts index 75a2b4e380a..675a2c946b4 100644 --- a/packages/search/lib/commands/index.ts +++ b/packages/search/lib/commands/index.ts @@ -501,7 +501,7 @@ export function pushSearchOptions( ); } - if (options?.PARAMS) { + if (options?.PARAMS && Object.keys(options.PARAMS).length > 0) { pushParamsArgs(args, options.PARAMS); } @@ -579,7 +579,7 @@ interface ProfileData { iteratorsProfile: IteratorsProfile } -export function transformProfile(reply: Array): ProfileData{ +export function transformProfile(reply: Array): ProfileData { return { totalProfileTime: reply[0][1], parsingTime: reply[1][1], @@ -591,7 +591,7 @@ export function transformProfile(reply: Array): ProfileData{ function transformIterators(IteratorsProfile: Array): IteratorsProfile { var res: IteratorsProfile = {}; for (let i = 0; i < IteratorsProfile.length; i += 2) { - const value = IteratorsProfile[i+1]; + const value = IteratorsProfile[i + 1]; switch (IteratorsProfile[i]) { case 'Type': res.type = value; @@ -617,7 +617,7 @@ function transformIterators(IteratorsProfile: Array): IteratorsProfile { function transformChildIterators(IteratorsProfile: Array): ChildIterator { var res: ChildIterator = {}; for (let i = 1; i < IteratorsProfile.length; i += 2) { - const value = IteratorsProfile[i+1]; + const value = IteratorsProfile[i + 1]; switch (IteratorsProfile[i]) { case 'Type': res.type = value;