From 8d61968dc9329f998cadfb2d4da49e53a6e7c43e Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 00:27:16 +0200 Subject: [PATCH] Make filters take the whole thread to be more flexible --- src/rss_thread_watch/feed_generator.clj | 2 +- src/rss_thread_watch/filters.clj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index 3ed7414..ed9cbe5 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -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 diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj index fe006c1..1573583 100644 --- a/src/rss_thread_watch/filters.clj +++ b/src/rss_thread_watch/filters.clj @@ -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