summaryrefslogtreecommitdiff
path: root/ext/bg/js/database.js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-11-13 18:51:50 -0800
committerGitHub <noreply@github.com>2019-11-13 18:51:50 -0800
commitb1659522b30cecc0583745da5a44fdd75660274a (patch)
tree89c17fa51f91ee43b1a206a9ae2d7b5721892ae9 /ext/bg/js/database.js
parent7d9d45ae10302582ce7431bd72ec4f8604dc5e65 (diff)
parent7333873244ccaeeefe01bd3a63447f39dd4f3bbe (diff)
Merge pull request #274 from toasted-nutbread/lookup-wildcards
Lookup wildcards
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r--ext/bg/js/database.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index b6cf9063..9b560f78 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -130,7 +130,7 @@ class Database {
await Promise.all(promises);
}
- async findTermsBulk(termList, titles) {
+ async findTermsBulk(termList, titles, wildcard) {
this.validate();
const promises = [];
@@ -149,10 +149,11 @@ class Database {
const dbIndex2 = dbTerms.index('reading');
for (let i = 0; i < termList.length; ++i) {
- const only = IDBKeyRange.only(termList[i]);
+ const term = termList[i];
+ const query = wildcard ? IDBKeyRange.bound(term, `${term}\uffff`, false, false) : IDBKeyRange.only(term);
promises.push(
- Database.getAll(dbIndex1, only, i, processRow),
- Database.getAll(dbIndex2, only, i, processRow)
+ Database.getAll(dbIndex1, query, i, processRow),
+ Database.getAll(dbIndex2, query, i, processRow)
);
}