Revert sort-only indexes

This commit is contained in:
Anatoliy Chakkaev 2012-09-09 19:54:33 +04:00
parent dee112a35c
commit e39691763f
1 changed files with 1 additions and 7 deletions

View File

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