summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-06 13:27:20 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-07 15:53:55 -0500
commitc073c4a70630ac58b4e97ad152f14485481fb3a5 (patch)
tree185389c440e580d0a295d19f2cc0a5b753602500 /ext
parent8694e94f294997166b5874094ebc4f516d423e3b (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 163affd3..56509e39 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -1284,12 +1284,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
@@ -1300,6 +1296,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; }