diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-04 20:52:08 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-10 14:02:43 -0500 |
commit | 7333873244ccaeeefe01bd3a63447f39dd4f3bbe (patch) | |
tree | 96c75fbc5ddad4850132dfd6f59f47cb6925dac0 /ext/bg/js/database.js | |
parent | 3a225c3f916d435e04fb30afa731c30c4309fc7f (diff) |
Add support for wildcards
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 9 |
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) ); } |