Implement CaseSensitiveQuery #39

Merged
Felisp merged 12 commits from CaseSensitiveQuery into stable 2024-09-24 02:07:26 +02:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 8d61968dc9 - Show all commits

View file

@ -64,7 +64,7 @@
(let [filterable (select-keys query-string
(keys known-filter-map))]
(ut/fkmap (fn [k v]
{(get known-filter-map k) v})
{(get known-filter-map k) (ut/vectorize v)})
filterable)))
(defn filter-chod-posts

View file

@ -20,15 +20,15 @@
(defn case-sensitive-filter
"Returns true if string [s] is matched by any query. It's case insensitive"
[s queries]
[{:keys [title]} queries]
(some (fn [querry]
(cs/includes? s querry))
(cs/includes? title querry))
queries))
(defn case-insensitive-filter
"Returns true if string [s] is case-matched by query"
[s queries]
(case-sensitive-filter (cs/lower-case s) (map cs/lower-case queries)))
[{:keys [title]} queries]
(case-sensitive-filter {:title (cs/lower-case title)} (map cs/lower-case queries)))
(def known-filters
{"Q" case-sensitive-filter