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
19 changes: 12 additions & 7 deletions lib/reds.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ var types = {
* @api public
*/

exports.createClient = function(){
exports.createClient = function(port, host){
return exports.client
|| (exports.client = redis.createClient());
|| (exports.client = redis.createClient(port, host));
};

/**
Expand All @@ -66,9 +66,9 @@ exports.createClient = function(){
* @api public
*/

exports.createSearch = function(key){
exports.createSearch = function(key, options){
if (!key) throw new Error('createSearch() requires a redis key for namespacing');
return new Search(key);
return new Search(key, options);
};

/**
Expand All @@ -80,7 +80,7 @@ exports.createSearch = function(key){
*/

exports.words = function(str){
return String(str).match(/\w+/g);
return String(str).match(/(\w|[\u4E00-\u9FA5])+/g);
};

/**
Expand Down Expand Up @@ -281,12 +281,17 @@ Query.prototype.end = function(fn){
* Initialize a new `Search` with the given `key`.
*
* @param {String} key
* @param {Object} redis options
* @api public
*/

function Search(key) {
function Search(key, options) {
options = options || {};
this.key = key;
this.client = exports.createClient();
this.client = exports.createClient(options.port, options.host);
if (options.password) {
this.client.auth(options.password);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"dependencies": {
"natural": "0.1.17",
"redis": "0.7.2"
"redis": "0.10.1"
},
"devDependencies": {
"should": "*",
Expand Down