Fixing upper bounds on contact search (fixes #545)

This commit is contained in:
Karel Bilek 2015-12-31 23:05:41 +01:00 committed by lilia
parent a229075016
commit 557d33bf88
3 changed files with 12 additions and 7 deletions

View file

@ -421,13 +421,15 @@
}); });
} else if (options.index) { } else if (options.index) {
index = store.index(options.index.name); index = store.index(options.index.name);
var excludeLower = !!options.index.excludeLower;
var excludeUpper = !!options.index.excludeUpper;
if (index) { if (index) {
if (options.index.lower && options.index.upper) { if (options.index.lower && options.index.upper) {
bounds = IDBKeyRange.bound(options.index.lower, options.index.upper); bounds = IDBKeyRange.bound(options.index.lower, options.index.upper, excludeLower, excludeUpper);
} else if (options.index.lower) { } else if (options.index.lower) {
bounds = IDBKeyRange.lowerBound(options.index.lower); bounds = IDBKeyRange.lowerBound(options.index.lower, excludeLower);
} else if (options.index.upper) { } else if (options.index.upper) {
bounds = IDBKeyRange.upperBound(options.index.upper); bounds = IDBKeyRange.upperBound(options.index.upper, excludeUpper);
} else if (options.index.only) { } else if (options.index.only) {
bounds = IDBKeyRange.only(options.index.only); bounds = IDBKeyRange.only(options.index.only);
} }

View file

@ -21779,13 +21779,15 @@ return jQuery;
}); });
} else if (options.index) { } else if (options.index) {
index = store.index(options.index.name); index = store.index(options.index.name);
var excludeLower = !!options.index.excludeLower;
var excludeUpper = !!options.index.excludeUpper;
if (index) { if (index) {
if (options.index.lower && options.index.upper) { if (options.index.lower && options.index.upper) {
bounds = IDBKeyRange.bound(options.index.lower, options.index.upper); bounds = IDBKeyRange.bound(options.index.lower, options.index.upper, excludeLower, excludeUpper);
} else if (options.index.lower) { } else if (options.index.lower) {
bounds = IDBKeyRange.lowerBound(options.index.lower); bounds = IDBKeyRange.lowerBound(options.index.lower, excludeLower);
} else if (options.index.upper) { } else if (options.index.upper) {
bounds = IDBKeyRange.upperBound(options.index.upper); bounds = IDBKeyRange.upperBound(options.index.upper, excludeUpper);
} else if (options.index.only) { } else if (options.index.only) {
bounds = IDBKeyRange.only(options.index.only); bounds = IDBKeyRange.only(options.index.only);
} }

View file

@ -408,7 +408,8 @@
index: { index: {
name: 'search', // 'search' index on tokens array name: 'search', // 'search' index on tokens array
lower: query, lower: query,
upper: upper upper: upper,
excludeUpper: true
} }
}).always(resolve); }).always(resolve);
}.bind(this)); }.bind(this));