Improve secondary definitions (#1731)

* Improve secondary search definitions

* Simplify
This commit is contained in:
toasted-nutbread 2021-06-05 23:17:13 -04:00 committed by GitHub
parent d87515ec12
commit 3a095b1f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -425,17 +425,13 @@ class Translator {
let target = targetMap.get(key); let target = targetMap.get(key);
if (typeof target === 'undefined') { if (typeof target === 'undefined') {
target = { target = {
groups: [], groups: []
searchSecondary: false
}; };
targetMap.set(key, target); targetMap.set(key, target);
} }
target.groups.push(group); target.groups.push(group);
if (!dictionaryEntry.isPrimary && !target.searchSecondary) { termList.push({term, reading});
target.searchSecondary = true; targetList.push(target);
termList.push({term, reading});
targetList.push(target);
}
} }
} }
@ -495,6 +491,8 @@ class Translator {
return newDictionaryEntries; return newDictionaryEntries;
} }
// Removing data
_removeExcludedDefinitions(dictionaryEntries, excludeDictionaryDefinitions) { _removeExcludedDefinitions(dictionaryEntries, excludeDictionaryDefinitions) {
for (let i = dictionaryEntries.length - 1; i >= 0; --i) { for (let i = dictionaryEntries.length - 1; i >= 0; --i) {
const dictionaryEntry = dictionaryEntries[i]; const dictionaryEntry = dictionaryEntries[i];