Skip to content

Commit 25b76d4

Browse files
committed
Merge branch 'master' of github.com:redis/node-redis
2 parents 11e6d49 + 6a850d3 commit 25b76d4

24 files changed

+1428
-1447
lines changed

benchmark/package-lock.json

+36-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmark/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"dependencies": {
1010
"@redis/client": "../packages/client",
1111
"hdr-histogram-js": "3.0.0",
12-
"ioredis": "5.0.4",
12+
"ioredis": "5.1.0",
1313
"redis-v3": "npm:[email protected]",
14-
"yargs": "17.4.1"
14+
"yargs": "17.5.1"
1515
}
1616
}

examples/count-min-sketch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function countMinSketch() {
1515
// https://oss.redis.com/redisbloom/CountMinSketch_Commands/#cmsinitbyprob
1616
try {
1717
await client.cms.initByProb('mycms', 0.001, 0.01);
18-
console.log('Reserved Top K.');
18+
console.log('Initialized Count-Min Sketch.');
1919
} catch (e) {
2020
console.log('Error, maybe RedisBloom is not installed?:');
2121
console.log(e);

examples/search-hashes.js

+25-16
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,38 @@ async function searchHashes() {
4040
client.hSet('noderedis:animals:4', {name: 'Fido', species: 'dog', age: 7})
4141
]);
4242

43-
// Perform a search query, find all the dogs...
43+
// Perform a search query, find all the dogs... sort by age, descending.
4444
// Documentation: https://oss.redis.com/redisearch/Commands/#ftsearch
45-
// Query synatax: https://oss.redis.com/redisearch/Query_Syntax/
46-
const results = await client.ft.search('idx:animals', '@species:{dog}');
45+
// Query syntax: https://oss.redis.com/redisearch/Query_Syntax/
46+
const results = await client.ft.search(
47+
'idx:animals',
48+
'@species:{dog}',
49+
{
50+
SORTBY: {
51+
BY: 'age',
52+
DIRECTION: 'DESC' // or 'ASC' (default if DIRECTION is not present)
53+
}
54+
}
55+
);
4756

4857
// results:
4958
// {
5059
// total: 2,
5160
// documents: [
52-
// {
53-
// id: 'noderedis:animals:4',
61+
// {
62+
// id: 'noderedis:animals:3',
5463
// value: {
55-
// name: 'Fido',
56-
// species: 'dog',
57-
// age: '7'
64+
// age: '9',
65+
// name: 'Rover',
66+
// species: 'dog'
5867
// }
5968
// },
6069
// {
61-
// id: 'noderedis:animals:3',
70+
// id: 'noderedis:animals:4',
6271
// value: {
63-
// name: 'Rover',
64-
// species: 'dog',
65-
// age: '9'
72+
// age: '7',
73+
// name: 'Fido',
74+
// species: 'dog'
6675
// }
6776
// }
6877
// ]
@@ -71,12 +80,12 @@ async function searchHashes() {
7180
console.log(`Results found: ${results.total}.`);
7281

7382
for (const doc of results.documents) {
74-
// noderedis:animals:4: Fido
75-
// noderedis:animals:3: Rover
76-
console.log(`${doc.id}: ${doc.value.name}`);
83+
// noderedis:animals:3: Rover, 9 years old.
84+
// noderedis:animals:4: Fido, 7 years old.
85+
console.log(`${doc.id}: ${doc.value.name}, ${doc.value.age} years old.`);
7786
}
7887

7988
await client.quit();
8089
}
8190

82-
searchHashes();
91+
searchHashes();

0 commit comments

Comments
 (0)