summaryrefslogtreecommitdiff
path: root/ext/bg/js/database.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-23 22:54:06 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-07 14:34:35 -0500
commit1a0a345ae745781b6fb1d066df334b641a9cc00b (patch)
tree8cee5018387e53ef698ebb8221d3124ef0bb03cd /ext/bg/js/database.js
parent16593408981d59e1bd3ad4de14071f45a8116d81 (diff)
Make reverse reading/expressions optional during database import
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r--ext/bg/js/database.js19
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);
};