Add an index for going from a post to its replies

This commit is contained in:
Ben Lubar
2016-09-24 14:43:48 -05:00
parent 2824ce5587
commit fae28ed3cc
4 changed files with 78 additions and 1 deletions

View File

@@ -82,6 +82,12 @@ module.exports = function (Posts) {
function (next) {
db.sortedSetAdd('posts:pid', timestamp, postData.pid, next);
},
function (next) {
if (!postData.toPid) {
return next(null);
}
db.sortedSetAdd('pid:' + postData.toPid + ':replies', timestamp, postData.pid, next);
},
function (next) {
db.incrObjectField('global', 'postCount', next);
}