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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# recommendationRaccoon (raccoon)

##Updated to handle Azure Redis server ##

<img align="right" src="http://i42.tinypic.com/2d12qli.png">

An easy-to-use collaborative filtering based recommendation engine and NPM module built on top of Node.js and Redis. The engine uses the Jaccard coefficient to determine the similarity between users and k-nearest-neighbors to create recommendations. This module is useful for anyone with users, a store of products/movies/items, and the desire to give their users the ability to like/dislike and receive recommendations based on similar users. Raccoon takes care of all the recommendation and rating logic. It can be paired with any database as it does not keep track of any user/item information besides a unique ID.
Expand Down
1 change: 1 addition & 0 deletions lib/algorithms.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const async = require('async'),
config = require('./config.js'),
_ = require('underscore'),
client = require('./client.js'),
Key = require('./key');

// the jaccard coefficient outputs an objective measurement of the similarity between two objects. in this case, two users. the coefficient
Expand Down
22 changes: 17 additions & 5 deletions lib/client.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@

const redis = require('redis'),
config = require('./config'),
bluebird = require('bluebird');

bluebird.promisifyAll(redis.RedisClient.prototype);

client = redis.createClient(config.redisPort, config.redisUrl);
if (config.redisAuth){
client.auth(config.redisAuth, function (err) {
if (err) { throw err; }
let client;
if (config.redisUseSsl) {
client = redis.createClient(config.redisPort, config.redisUrl, {
socket_keepalive: true,
connect_timeout: 10000,
retry_max_delay: 200,
max_attempts: 5,
auth_pass: config.redisAuth,
tls: {servername: config.redisUrl},
});
} else {
client = redis.createClient(config.redisPort, config.redisUrl, {
socket_keepalive: true,
connect_timeout: 10000,
retry_max_delay: 200,
max_attempts: 5,
auth_pass: config.redisAuth,
});
}

Expand Down
1 change: 1 addition & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Config {
this.redisUrl = process.env.RACCOON_REDIS_URL || '127.0.0.1';
this.redisPort = process.env.RACCOON_REDIS_PORT || 6379;
this.redisAuth = process.env.RACCOON_REDIS_AUTH || '';
this.redisUseSsl = process.env.RACCOON_REDIS_ENABLE_SSL || false;
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const config = require('./config.js'),
algo = require('./algorithms.js'),
async = require('async'),
client = require('./client.js'),
Key = require('./key');

const updateSequence = function(userId, itemId, options = {}){
Expand Down