Skip to content

Commit

Permalink
Fix redis#2646 for v4
Browse files Browse the repository at this point in the history
Auto formatter did some thingy...
  • Loading branch information
Didas-git committed Nov 4, 2023
1 parent c64ce74 commit d90e06c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/search/lib/commands/SEARCH.spec.ts
Expand Up @@ -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: {
Expand Down
8 changes: 4 additions & 4 deletions packages/search/lib/commands/index.ts
Expand Up @@ -501,7 +501,7 @@ export function pushSearchOptions(
);
}

if (options?.PARAMS) {
if (options?.PARAMS && Object.keys(options.PARAMS).length > 0) {
pushParamsArgs(args, options.PARAMS);
}

Expand Down Expand Up @@ -579,7 +579,7 @@ interface ProfileData {
iteratorsProfile: IteratorsProfile
}

export function transformProfile(reply: Array<any>): ProfileData{
export function transformProfile(reply: Array<any>): ProfileData {
return {
totalProfileTime: reply[0][1],
parsingTime: reply[1][1],
Expand All @@ -591,7 +591,7 @@ export function transformProfile(reply: Array<any>): ProfileData{
function transformIterators(IteratorsProfile: Array<any>): 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;
Expand All @@ -617,7 +617,7 @@ function transformIterators(IteratorsProfile: Array<any>): IteratorsProfile {
function transformChildIterators(IteratorsProfile: Array<any>): 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;
Expand Down

0 comments on commit d90e06c

Please sign in to comment.