diff --git a/lib/search/word_search/entry_id_query.dart b/lib/search/word_search/entry_id_query.dart index 1dabd31..10c12de 100644 --- a/lib/search/word_search/entry_id_query.dart +++ b/lib/search/word_search/entry_id_query.dart @@ -53,7 +53,7 @@ String _filterFTSSensitiveCharacters(String word) { SELECT DISTINCT "${tableName}"."entryId", 100 - + (("${tableName}FTS"."reading" = ?) * 50) + + (("${tableName}FTS"."reading" = ?) * 10000) + "JMdict_EntryScore"."score" AS "score" FROM "${tableName}FTS" @@ -61,8 +61,6 @@ String _filterFTSSensitiveCharacters(String word) { JOIN "JMdict_EntryScore" USING ("elementId") WHERE "${tableName}FTS"."reading" MATCH ? || '*' AND "JMdict_EntryScore"."type" = '${tableName == JMdictTableNames.kanjiElement ? 'k' : 'r'}' - ORDER BY - "JMdict_EntryScore"."score" DESC ${!countOnly ? 'LIMIT ?' : ''} ), non_fts_results AS ( @@ -76,9 +74,6 @@ String _filterFTSSensitiveCharacters(String word) { WHERE "reading" LIKE '%' || ? || '%' AND "${tableName}"."entryId" NOT IN (SELECT "entryId" FROM "fts_results") AND "JMdict_EntryScore"."type" = '${tableName == JMdictTableNames.kanjiElement ? 'k' : 'r'}' - ORDER BY - "JMdict_EntryScore"."score" DESC, - "${tableName}"."entryId" ASC ${!countOnly ? 'LIMIT ?' : ''} ) @@ -89,6 +84,9 @@ String _filterFTSSensitiveCharacters(String word) { SELECT * FROM non_fts_results ) GROUP BY "entryId" + ORDER BY + "score" DESC, + "entryId" ASC ''' .trim(), [