use the first set for sorting

This commit is contained in:
Baris Usakli
2017-11-08 16:32:34 -05:00
parent 4fdc1b99c6
commit 5604c62776
2 changed files with 16 additions and 1 deletions

View File

@@ -90,7 +90,10 @@ module.exports = function (Categories) {
var stop = data.stop === -1 ? data.stop : start + normalTidsToGet - 1;
if (Array.isArray(set)) {
db[direction === 'highest-to-lowest' ? 'getSortedSetRevIntersect' : 'getSortedSetIntersect']({ sets: set, start: start, stop: stop }, next);
var weights = set.map(function (s, index) {
return index ? 0 : 1;
});
db[direction === 'highest-to-lowest' ? 'getSortedSetRevIntersect' : 'getSortedSetIntersect']({ sets: set, start: start, stop: stop, weights: weights }, next);
} else {
db[direction === 'highest-to-lowest' ? 'getSortedSetRevRange' : 'getSortedSetRange'](set, start, stop, next);
}