summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-10-14 13:07:48 +0600
committerunwox <me@unwox.com>2025-10-14 13:07:48 +0600
commit163773bdf237ba80a34a4a5366df826933f2cd8a (patch)
treed0a2f1244f7af51dc7ee274a4cd863e2ad7aefc1 /pages
parent668aeb1730978c3712ed5a83f927e69e2b8e114c (diff)
improve products search
Diffstat (limited to 'pages')
-rw-r--r--pages/shop/index.fnl8
1 files changed, 6 insertions, 2 deletions
diff --git a/pages/shop/index.fnl b/pages/shop/index.fnl
index 6b0f79b..58ff288 100644
--- a/pages/shop/index.fnl
+++ b/pages/shop/index.fnl
@@ -3,6 +3,7 @@
(local shop (require :shop))
(local dicts (require :dicts))
(local templates (require :templates))
+(local synonyms (require :synonyms))
(fn all-products [db filters authenticated?]
(local where-stmts [])
@@ -18,7 +19,10 @@
(when filters.search
(table.insert where-stmts "products_search MATCH ?")
- (table.insert where-args filters.search)
+ (var query (synonyms.replace filters.search))
+ (when (not (lib.ends-with? query "*"))
+ (set query (.. query "*")))
+ (table.insert where-args query)
(set has-search-query? true))
(local where
@@ -109,7 +113,7 @@
[:a {:style "white-space: nowrap; margin-left: 1rem;"
:href (.. "/shop/order/list")} "☰ Список заказов"]])
"")
- [:form {:class "d-flex gap-0-5 mb-1"}
+ [:form {:class "d-flex-desktop gap-0-5 mb-1"}
[:input {:name "search" :type "search"
:placeholder "Поиск" :value (or filters.search "")}]
[:select {:name "type"}