Comparing version 0.2.4 to 0.2.5
@@ -6,40 +6,7 @@ | ||
var uubench = require('uubench') | ||
, reds = require('../').createSearch('reds') | ||
, fs = require('fs'); | ||
var reds = require('../').createSearch('reds'); | ||
var fs = require('fs'); | ||
/** | ||
* Pad the given string. | ||
*/ | ||
// test data | ||
function pad(str, width) { | ||
return Array(width - str.length + 1).join(' ') + str; | ||
} | ||
/** | ||
* Global suite. | ||
*/ | ||
suite = new uubench.Suite({ | ||
start: function(){ | ||
console.log(); | ||
}, | ||
result: function(name, stats){ | ||
var persec = 1000 / stats.elapsed | ||
, ops = stats.iterations * persec; | ||
console.log(' \033[90m%s : \033[36m%s \033[90mops/s\033[0m' | ||
, pad(name, 20) | ||
, ops | 0); | ||
}, | ||
done: function(){ | ||
console.log(); | ||
} | ||
}); | ||
/** | ||
* Text bodies. | ||
*/ | ||
var tiny = fs.readFileSync('package.json', 'utf8'); | ||
@@ -51,24 +18,20 @@ tiny = Array(5).join(tiny); | ||
console.log(); | ||
console.log(' tiny: %dkb', (tiny.length / 1024).toFixed(2)); | ||
console.log(' small: %dkb', (small.length / 1024).toFixed(2)); | ||
console.log(' medium: %dkb', (medium.length / 1024).toFixed(2)); | ||
console.log(' large: %dmb', (large.length / 1024 / 1024).toFixed(2)); | ||
// benchmarks | ||
suite.bench('index() tiny', function(next){ | ||
reds.index(tiny, 0, next); | ||
}); | ||
suite('indexing', function(){ | ||
bench('tiny', function(done){ | ||
reds.index(tiny, '1234', done); | ||
}); | ||
// suite.bench('index() small', function(next){ | ||
// reds.index(small, 0, next); | ||
// }); | ||
bench('small', function(done){ | ||
reds.index(small, '1234', done); | ||
}); | ||
// suite.bench('index() medium', function(next){ | ||
// reds.index(medium, 1, next); | ||
// }); | ||
bench('medium', function(done){ | ||
reds.index(medium, '1234', done); | ||
}); | ||
// suite.bench('index() large', function(next){ | ||
// reds.index(large, 2, next); | ||
// }); | ||
suite.run(); | ||
bench('large', function(done){ | ||
reds.index(large, '1234', done); | ||
}); | ||
}); |
{ | ||
"name": "reds" | ||
, "version": "0.2.4" | ||
, "description": "Redis search for node.js" | ||
, "keywords": ["redis", "search", "metaphone", "phonetics", "natural"] | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
, "dependencies": { | ||
"natural": "0.1.17" | ||
, "redis": "0.7.2" | ||
"name": "reds", | ||
"version": "0.2.5", | ||
"description": "Redis search for node.js", | ||
"keywords": [ | ||
"redis", | ||
"search", | ||
"metaphone", | ||
"phonetics", | ||
"natural" | ||
], | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
"dependencies": { | ||
"natural": "^0.2.0", | ||
"redis": "^0.12.1" | ||
}, | ||
"devDependencies": { | ||
"matcha": "^0.6.0", | ||
"should": "^3.3.2", | ||
"superagent": "^0.21.0" | ||
}, | ||
"main": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/visionmedia/reds.git" | ||
} | ||
, "devDependencies": { | ||
"should": "*" | ||
, "uubench": "*" | ||
, "superagent": "*" | ||
} | ||
, "main": "index" | ||
} |
@@ -45,3 +45,3 @@ # reds | ||
By default reds performs an intersection of the search words, the previous example would yield the following output: | ||
By default reds performs an intersection of the search words. The previous example would yield the following output since only one string contains both "Tobi" _and_ "dollars": | ||
@@ -53,3 +53,3 @@ ``` | ||
We can tweak reds to perform a union by passing either "union" or "or" to `reds.search()` after the callback, indicating that _any_ of the constants computed may be present for the id to match. | ||
We can tweak reds to perform a union by passing either "union" or "or" to `Search#type()` in `reds.search()` between `Search#query()` and `Search#end()`, indicating that _any_ of the constants computed may be present for the id to match. | ||
@@ -59,2 +59,3 @@ ```js | ||
.query(query = 'tobi dollars') | ||
.type('or') | ||
.end(function(err, ids){ | ||
@@ -67,6 +68,6 @@ if (err) throw err; | ||
process.exit(); | ||
}, 'or'); | ||
}); | ||
``` | ||
The intersection would yield the following since only one string contains both "Tobi" _and_ "dollars". | ||
The union search would yield the following since three strings contain either "Tobi" _or_ "dollars": | ||
@@ -73,0 +74,0 @@ ``` |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
157
1
14953
325
1
+ Addednatural@0.2.1(transitive)
+ Addedredis@0.12.1(transitive)
- Removedbindings@1.5.0(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedhiredis@0.5.0(transitive)
- Removednan@2.22.0(transitive)
- Removednatural@0.1.17(transitive)
- Removedredis@0.7.2(transitive)
Updatednatural@^0.2.0
Updatedredis@^0.12.1