From 0da2db3898ced2a98fd0a8d62126f780f78fb622 Mon Sep 17 00:00:00 2001 From: Tanyawat Vittaypalotai Date: Fri, 24 Nov 2023 11:05:10 +0900 Subject: [PATCH] fix: results sorting --- src/modules/jisho/jisho.controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/jisho/jisho.controller.ts b/src/modules/jisho/jisho.controller.ts index 2f399be..1846d89 100644 --- a/src/modules/jisho/jisho.controller.ts +++ b/src/modules/jisho/jisho.controller.ts @@ -48,7 +48,7 @@ export class JishoController { `SELECT id, temp.word_id, dictionary_id, kanji, reading, entry."text" FROM ( SELECT DISTINCT word_id FROM entry WHERE ${ dictionaryId ? 'dictionary_id = $dictionary and' : '' - } instr(kanji, $term) OR instr(reading, $term) LIMIT $limit + } instr(kanji, $term) OR instr(reading, $term) ORDER BY length(entry.kanji) ASC, length(entry.reading) ASC LIMIT $limit ) as temp LEFT JOIN entry ON entry.word_id = temp.word_id ORDER BY length(entry.kanji) ASC, length(entry.reading) ASC`,