aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/dictionary.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2018-03-12 13:04:37 -0700
committerAlex Yatskov <alex@foosoft.net>2018-03-12 13:04:37 -0700
commit68cdd7d85b741d34133ea04b95a4eb1e49553ace (patch)
treeb6041ae3bbd2c327e57ca0766d77f3e11c654066 /ext/bg/js/dictionary.js
parentf0e9716aa5e763480cf6accceefcea4fa73bc149 (diff)
parent2470b6209a27ceea814a13d920a20683bacf09a6 (diff)
Merge branch 'dev'
Diffstat (limited to 'ext/bg/js/dictionary.js')
-rw-r--r--ext/bg/js/dictionary.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index fea5f3e5..368bb18d 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -245,22 +245,26 @@ function dictTermsMergeByGloss(result, definitions, appendTo, mergedIndices) {
result.expression.add(definition.expression);
result.reading.add(definition.reading);
- // result->expressions[ Expression1[ Reading1[ Tag1, Tag2 ] ], Expression2, ... ]
- if (!result.expressions.has(definition.expression)) {
- result.expressions.set(definition.expression, new Map());
- }
- if (!result.expressions.get(definition.expression).has(definition.reading)) {
- result.expressions.get(definition.expression).set(definition.reading, new Set());
- }
-
for (const tag of definition.definitionTags) {
if (!definitionsByGloss[gloss].definitionTags.find(existingTag => existingTag.name === tag.name)) {
definitionsByGloss[gloss].definitionTags.push(tag);
}
}
- for (const tag of definition.termTags) {
- result.expressions.get(definition.expression).get(definition.reading).add(tag);
+ if (!appendTo) {
+ // result->expressions[ Expression1[ Reading1[ Tag1, Tag2 ] ], Expression2, ... ]
+ if (!result.expressions.has(definition.expression)) {
+ result.expressions.set(definition.expression, new Map());
+ }
+ if (!result.expressions.get(definition.expression).has(definition.reading)) {
+ result.expressions.get(definition.expression).set(definition.reading, []);
+ }
+
+ for (const tag of definition.termTags) {
+ if (!result.expressions.get(definition.expression).get(definition.reading).find(existingTag => existingTag.name === tag.name)) {
+ result.expressions.get(definition.expression).get(definition.reading).push(tag);
+ }
+ }
}
}