Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2646 for v4 #2647

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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