summaryrefslogtreecommitdiff
path: root/ext/bg/js/database.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2017-10-05 05:21:07 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2017-10-05 05:21:07 +0300
commitcfad3b309976213c45f99bef3b8fad072c6bb9ec (patch)
treee2e92586367c5be0bfaaebe179bd407cadb471ad /ext/bg/js/database.js
parent03fd9dcdb451ad55b9b2d2b5bd489e6ca3ba648a (diff)
merged mode: add main dictionary selection
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r--ext/bg/js/database.js27
1 files changed, 14 insertions, 13 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 0de0505d..7a893fc0 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -85,25 +85,26 @@ class Database {
return results;
}
- async findTermsBySequence(sequence, dictionary) {
+ async findTermsBySequence(sequence, mainDictionary) {
if (!this.db) {
throw 'Database not initialized';
}
const results = [];
await this.db.terms.where('sequence').equals(sequence).each(row => {
- // if (dictionary === row.dictionary) {
- results.push({
- expression: row.expression,
- reading: row.reading,
- tags: dictFieldSplit(row.tags),
- rules: dictFieldSplit(row.rules),
- glossary: row.glossary,
- score: row.score,
- dictionary: row.dictionary,
- id: row.id,
- sequence: typeof row.sequence === 'undefined' ? -1 : row.sequence
- });
+ if (row.dictionary === mainDictionary) {
+ results.push({
+ expression: row.expression,
+ reading: row.reading,
+ tags: dictFieldSplit(row.tags),
+ rules: dictFieldSplit(row.rules),
+ glossary: row.glossary,
+ score: row.score,
+ dictionary: row.dictionary,
+ id: row.id,
+ sequence: typeof row.sequence === 'undefined' ? -1 : row.sequence
+ });
+ }
});
return results;