Implement CaseSensitiveQuery #39
2 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue