summaryrefslogtreecommitdiff
path: root/ext/bg/js/database.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-04 20:52:08 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-10 14:02:43 -0500
commit7333873244ccaeeefe01bd3a63447f39dd4f3bbe (patch)
tree96c75fbc5ddad4850132dfd6f59f47cb6925dac0 /ext/bg/js/database.js
parent3a225c3f916d435e04fb30afa731c30c4309fc7f (diff)
Add support for 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)
);
}