From b9063b6e5ddf3f15ad75fad3b6a2fdb0e2bfe129 Mon Sep 17 00:00:00 2001 From: unwox Date: Thu, 17 Oct 2024 16:40:38 +0600 Subject: new synonyms for queries --- bin/serve.fnl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/serve.fnl b/bin/serve.fnl index aeea929..988df00 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -26,6 +26,12 @@ (local query-synonyms { "шэн" "шен" "шен" "шэн" + "дянь" "дань" + "дань" "дянь" + "чжень" "чжэнь" + "чжэнь" "чжень" + "хун" "цун" + "цун" "хун" "доска" "чабань" "чабань" "доска" "термос" "бутылка" @@ -154,8 +160,9 @@ (table.insert where-vars (array.join (map (fn [_ q] - (if (. query-synonyms q) - (.. "(" q "* OR " (. query-synonyms q) "*)") + (local lower-q (must (luna.utf8.lower q))) + (if (. query-synonyms lower-q) + (.. "(" q "* OR " (. query-synonyms lower-q) "*)") (.. q "*"))) (str.split query " ")) " AND "))) -- cgit v1.2.3