Skip to content

Commit

Permalink
Update search-json.js (#2317)
Browse files Browse the repository at this point in the history
  • Loading branch information
leibale committed Oct 31, 2022
1 parent 252c219 commit 5a25078
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/search-json.js
Expand Up @@ -65,8 +65,8 @@ console.log('Users under 30 years old:');
console.log(
// https://redis.io/commands/ft.search/
JSON.stringify(
await client.ft.search('idx:users', '@age:[0 30]'),
null,
await client.ft.search('idx:users', '@age:[0 30]'),
null,
2
)
);
Expand All @@ -89,11 +89,11 @@ console.log(
// in the email address. This applies for other punctuation too.
// https://redis.io/docs/stack/search/reference/tags/#including-punctuation-in-tags
console.log('Users with email "bob@somewhere.gov":');
const emailAddress = 'bob@somewhere.gov'.replace(/[.@]/g, '\\$&');
const emailAddress = 'bob@somewhere.gov'.replace(/[.@\\]/g, '\\$&');
console.log(
JSON.stringify(
await client.ft.search('idx:users', `@email:{${emailAddress}}`),
null,
await client.ft.search('idx:users', `@email:{${emailAddress}}`),
null,
2
)
);
Expand Down Expand Up @@ -130,8 +130,8 @@ console.log(
AS: 'totalCoins'
}]
}]
}),
null,
}),
null,
2
)
);
Expand Down

0 comments on commit 5a25078

Please sign in to comment.