diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-13 02:40:20 +0300 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2017-10-13 02:40:20 +0300 |
commit | 7ec28bea5422cda4304b660eccdb39d690f74fad (patch) | |
tree | ddd2fa3d0f9aaf8adca9dbfb822d1f511d4860aa /ext/bg/js/database.js | |
parent | c0f56480bb34b8811835b8d545443bd9ea87c997 (diff) |
change db format, rename tags to definitionTags
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 1c2194df..8350e214 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -68,12 +68,11 @@ class Database { const results = []; await this.db.terms.where('expression').equals(term).or('reading').equals(term).each(row => { if (titles.includes(row.dictionary)) { - const tags = row.tags.split('\t'); results.push({ expression: row.expression, reading: row.reading, - tags: dictFieldSplit(tags[0]), - termTags: tags.length > 1 ? dictFieldSplit(tags[1]) : [], + definitionTags: dictFieldSplit(row.definitionTags), + termTags: dictFieldSplit(row.termTags || ''), rules: dictFieldSplit(row.rules), glossary: row.glossary, score: row.score, @@ -95,12 +94,11 @@ class Database { const results = []; await this.db.terms.where('sequence').equals(sequence).each(row => { if (row.dictionary === mainDictionary) { - const tags = row.tags.split('\t'); results.push({ expression: row.expression, reading: row.reading, - tags: dictFieldSplit(tags[0]), - termTags: tags.length > 1 ? dictFieldSplit(tags[1]) : [], + definitionTags: dictFieldSplit(row.definitionTags), + termTags: dictFieldSplit(row.termTags || ''), rules: dictFieldSplit(row.rules), glossary: row.glossary, score: row.score, @@ -229,11 +227,11 @@ class Database { const rows = []; if (summary.version === 1) { - for (const [expression, reading, tags, rules, score, ...glossary] of entries) { + for (const [expression, reading, definitionTags, rules, score, ...glossary] of entries) { rows.push({ expression, reading, - tags, + definitionTags, rules, score, glossary, @@ -241,15 +239,16 @@ class Database { }); } } else { - for (const [expression, reading, tags, rules, score, glossary, sequence] of entries) { + for (const [expression, reading, definitionTags, rules, score, glossary, sequence, termTags] of entries) { rows.push({ expression, reading, - tags, + definitionTags, rules, score, glossary, sequence, + termTags, dictionary: summary.title }); } |