search/word_search: score matching kana higher than converted kana
Build and test / build (push) Failing after 3m2s
Build and test / build (push) Failing after 3m2s
This commit is contained in:
@@ -67,25 +67,28 @@ String _filterFTSSensitiveCharacters(String word) {
|
||||
SELECT DISTINCT
|
||||
"$tableName"."entryId",
|
||||
100
|
||||
+ (("${tableName}FTS"."reading" = normalize_jp(?)) * 10000)
|
||||
+ (("$tableName"."reading" = ?1) * 100000)
|
||||
+ (("${tableName}FTS"."reading" = normalize_jp(?1)) * 10000)
|
||||
+ (("$tableName"."reading" LIKE ?1 || '%') * 20)
|
||||
+ (("$tableName"."orderNum" = 0) * 20)
|
||||
+ COALESCE("JMdict_EntryScore"."score", 0)
|
||||
AS "score"
|
||||
FROM "${tableName}FTS"
|
||||
JOIN "$tableName" USING ("elementId")
|
||||
LEFT JOIN "JMdict_EntryScore" USING ("elementId")
|
||||
WHERE "${tableName}FTS"."reading" MATCH normalize_jp(?) || '*'
|
||||
WHERE "${tableName}FTS"."reading" MATCH normalize_jp(?1) || '*'
|
||||
),
|
||||
non_fts_results AS (
|
||||
SELECT DISTINCT
|
||||
"$tableName"."entryId",
|
||||
50
|
||||
+ (("$tableName"."reading" LIKE '%' || ?1 || '%') * 20)
|
||||
+ (("$tableName"."orderNum" = 0) * 20)
|
||||
+ COALESCE("JMdict_EntryScore"."score", 0)
|
||||
AS "score"
|
||||
FROM "$tableName"
|
||||
LEFT JOIN "JMdict_EntryScore" USING ("elementId")
|
||||
WHERE "reading" LIKE '%' || normalize_jp(?) || '%'
|
||||
WHERE "$tableName"."reading" LIKE '%' || normalize_jp(?1) || '%'
|
||||
AND "$tableName"."entryId" NOT IN (SELECT "entryId" FROM "fts_results")
|
||||
)
|
||||
|
||||
@@ -102,8 +105,6 @@ String _filterFTSSensitiveCharacters(String word) {
|
||||
'''
|
||||
.trim(),
|
||||
[
|
||||
_filterFTSSensitiveCharacters(word),
|
||||
_filterFTSSensitiveCharacters(word),
|
||||
_filterFTSSensitiveCharacters(word),
|
||||
?pageSize,
|
||||
?offset,
|
||||
|
||||
Reference in New Issue
Block a user