added callback
@ -41,7 +41,10 @@ module.exports = function(db, module) {
module.searchRemove = function(key, id, callback) {
callback = callback || helpers.noop;
db.collection('search').remove({key:key, id:id}, callback);
if (!id) {
return callback();
}
db.collection('search').remove({key: key, id: id}, callback);
};
module.flushdb = function(callback) {
@ -26,7 +26,12 @@ module.exports = function(redisClient, module) {
if(key === 'post') {
callback = callback || function() {};
if (key === 'post') {
module.postSearch.remove(id, callback);
} else if(key === 'topic') {
module.topicSearch.remove(id, callback);