diff options
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 2d309f85..c6717560 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -332,9 +332,11 @@ class Database { return result; } - async importDictionary(archive, progressCallback, exceptions) { + async importDictionary(archive, progressCallback, exceptions, details) { this.validate(); + const prefixWildcardsSupported = details.prefixWildcardsSupported; + const maxTransactionLength = 1000; const bulkAdd = async (objectStoreName, items, total, current) => { const db = this.db; @@ -389,9 +391,7 @@ class Database { rules, score, glossary, - dictionary: summary.title, - expressionReverse: stringReverse(expression), - readingReverse: stringReverse(reading) + dictionary: summary.title }); } } else { @@ -405,13 +405,18 @@ class Database { glossary, sequence, termTags, - dictionary: summary.title, - expressionReverse: stringReverse(expression), - readingReverse: stringReverse(reading) + dictionary: summary.title }); } } + if (prefixWildcardsSupported) { + for (const row of rows) { + row.expressionReverse = stringReverse(row.expression); + row.readingReverse = stringReverse(row.reading); + } + } + await bulkAdd('terms', rows, total, current); }; |