From 858337c63369b02a5b33cf95d2398c8b525db0ca Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 8 May 2013 14:41:06 -0400 Subject: [PATCH] refactoring topics to be stored as a set per category, instead of a list --- src/topics.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/topics.js b/src/topics.js index e06b0458fd..bf6c0a7086 100644 --- a/src/topics.js +++ b/src/topics.js @@ -20,7 +20,7 @@ var RDB = require('./redis.js'), //build a proper wrapper for this and move it into above function later var range_var = (category_id) ? 'categories:' + category_id + ':tid' : 'topics:tid'; - RDB.lrange(range_var, start, end, function(tids) { + RDB.db.smembers(range_var, function(err, tids) { var title = [], uid = [], timestamp = [], @@ -116,7 +116,6 @@ var RDB = require('./redis.js'), }); - //} else callback({'category_id': category_id, 'topics': []}); }); } @@ -150,7 +149,7 @@ var RDB = require('./redis.js'), if (category_id) { - RDB.lpush('categories:' + category_id + ':tid', tid); + RDB.db.sadd('categories:' + category_id + ':tid', tid); } var slug = tid + '/' + utils.slugify(title);