aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/database.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2017-10-15 05:19:16 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2017-10-15 05:19:16 +0300
commit03f7ca23e118c5ca804eef35cea05070e69779c7 (patch)
treef7f66ed1a2ad3b782af8cd84ffb5d3203b1928ac /ext/bg/js/database.js
parent4203fda906a1b4a104187e54d256e5952d8ae55c (diff)
merged mode: add secondary searches
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r--ext/bg/js/database.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 8350e214..dea78196 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -86,6 +86,32 @@ class Database {
return results;
}
+ async findTermsExact(term, reading, titles) {
+ if (!this.db) {
+ throw 'Database not initialized';
+ }
+
+ const results = [];
+ await this.db.terms.where('expression').equals(term).each(row => {
+ if (row.reading === reading && titles.includes(row.dictionary)) {
+ results.push({
+ expression: row.expression,
+ reading: row.reading,
+ definitionTags: dictFieldSplit(row.definitionTags),
+ termTags: dictFieldSplit(row.termTags || ''),
+ 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;
+ }
+
async findTermsBySequence(sequence, mainDictionary) {
if (!this.db) {
throw 'Database not initialized';