Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/search/lib/commands/SEARCH.spec.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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