Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Optimize search filtering for only personal collections (#61731)

Chris Truter3b516a576a2c
diff --git a/src/metabase/search/filter.clj b/src/metabase/search/filter.clj
index 77c9ab35d36..7fd78fd8a31 100644
--- a/src/metabase/search/filter.clj
+++ b/src/metabase/search/filter.clj
@@ -95,7 +95,9 @@
"only-mine"
[:or
[:= :collection.personal_owner_id current-user-id]
- [:like :collection.location (format "/%d/%%" (t2/select-one-pk :model/Collection :personal_owner_id [:= current-user-id]))]]
+ [:like :collection.location (format "/%d/%%" (t2/select-one-pk :model/Collection
+ :personal_owner_id [:= current-user-id]
+ :location "/"))]]
"exclude-others"
(let [with-filter #(personal-collections-where-clause
@@ -103,7 +105,7 @@
collection-id-col)]
[:or (with-filter "only-mine") (with-filter "exclude")])
- (let [personal-ids (t2/select-pks-vec :model/Collection :personal_owner_id [:not= nil])
+ (let [personal-ids (t2/select-pks-vec :model/Collection :personal_owner_id [:not= nil] :location "/")
child-patterns (for [id personal-ids] (format "/%d/%%" id))]
(case filter-type
"only"