diff --git a/lib/adapters/redis2.js b/lib/adapters/redis2.js index c5b6cf0e..79a19ae1 100644 --- a/lib/adapters/redis2.js +++ b/lib/adapters/redis2.js @@ -163,12 +163,14 @@ BridgeToRedis.prototype.define = function (descr) { Object.keys(descr.properties).forEach(function (prop) { if (descr.properties[prop].index) { this.indexes[m][prop] = descr.properties[prop].type; + this.indexes[m][prop].kind = descr.properties[prop].index; } }.bind(this)); }; BridgeToRedis.prototype.defineForeignKey = function (model, key, cb) { this.indexes[model][key] = Number; + this.indexes[model][key].kind = true; cb(null, Number); }; @@ -218,6 +220,9 @@ BridgeToRedis.prototype.updateIndexes = function (model, id, data, callback, pre schedule.push(['SADD', 's:' + model, id]); } Object.keys(i).forEach(function (key) { + if (i === 'sort') { + return true; + } if (data.hasOwnProperty(key)) { var val = data[key]; schedule.push([ @@ -328,13 +333,14 @@ BridgeToRedis.prototype.possibleIndexes = function (model, filter) { var noIndex = []; Object.keys(filter.where).forEach(function (key) { var i = this.indexes[model][key]; - if (i) { + if (i.kind !== 'sort') { var val = filter.where[key]; if (i.name === 'Date') { val = val && val.getTime ? val.getTime() : 0; } foundIndex.push('i:' + model + ':' + key + ':' + val); } else { + console.log('noindex', i, key); noIndex.push(key); } }.bind(this));