Prepare more complex matching

This commit is contained in:
arne 2025-11-22 00:25:56 +01:00
commit ce56fb65c6
2 changed files with 20 additions and 11 deletions

View file

@ -4,7 +4,7 @@
[clojure.string :as str]
[clojure.pprint :as pprint]
[computersandblues.lodestone.database :as db]
[computersandblues.lodestone.match :refer [query->matching-fn]]
[computersandblues.lodestone.match :refer [query->matching-xform]]
[applied-science.js-interop :as j]))
(def posts-init-state
@ -293,7 +293,7 @@
; posts in the database and returns a result that will be rendered
; by the `post` component below.
xform (comp
(filter (query->matching-fn query))
(query->matching-xform query)
(take per-page)
(map #(js->clj % :keywordize-keys true)))
posts-cursor (db/open-cursor ::db/posts
@ -320,6 +320,10 @@
(let [inputs @search-result-inputs]
(debounced-refresh! inputs)))))
#_(defonce refresh-id-tracker (r/track! (fn []
(let [refresh-ids @(r/cursor state [:section/posts :loading])]
(js/console.log :refresh-id-tracker (count refresh-ids) refresh-ids)))))
(defn search [{:keys [query]}]
[:input {:placeholder "Start typing to search…"
:type "search"