summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-06 13:27:20 -0500
committerGitHub <noreply@github.com>2021-03-06 13:27:20 -0500
commit4bc53d2348bc07e1bad508de1ab9a8252bab10f4 (patch)
tree66958162d069a16c6aee3b7c37481c5b7b703f66 /ext
parent019c8cd4d7265012c74bbf4cbee9af7ef3ae310c (diff)
Use dictionary priority later in the definition sorting algorithm (#1492)
Diffstat (limited to 'ext')
-rw-r--r--ext/js/language/translator.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js
index ae613ba7..28cc1f3c 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -1304,12 +1304,8 @@ class Translator {
if (definitions.length <= 1) { return; }
const stringComparer = this._stringComparer;
const compareFunction = (v1, v2) => {
- // Sort by dictionary priority
- let i = v2.dictionaryOrder.priority - v1.dictionaryOrder.priority;
- if (i !== 0) { return i; }
-
// Sort by length of source term
- i = v2.source.length - v1.source.length;
+ let i = v2.source.length - v1.source.length;
if (i !== 0) { return i; }
// Sort by the number of inflection reasons
@@ -1320,6 +1316,10 @@ class Translator {
i = v2.sourceTermExactMatchCount - v1.sourceTermExactMatchCount;
if (i !== 0) { return i; }
+ // Sort by dictionary priority
+ i = v2.dictionaryOrder.priority - v1.dictionaryOrder.priority;
+ if (i !== 0) { return i; }
+
// Sort by term score
i = v2.score - v1.score;
if (i !== 0) { return i; }