From ac95bdd8b58e6b23442725c26323109e15400a5d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 8 Mar 2020 19:14:52 -0400 Subject: [PATCH] Adding community title and description searching. Fixes #589 --- server/src/db/community_view.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/db/community_view.rs b/server/src/db/community_view.rs index 18ff67a8a..f24c922c3 100644 --- a/server/src/db/community_view.rs +++ b/server/src/db/community_view.rs @@ -180,7 +180,11 @@ impl<'a> CommunityQueryBuilder<'a> { let mut query = self.query; if let Some(search_term) = self.search_term { - query = query.filter(name.ilike(fuzzy_search(&search_term))); + let searcher = fuzzy_search(&search_term); + query = query + .filter(name.ilike(searcher.to_owned())) + .or_filter(title.ilike(searcher.to_owned())) + .or_filter(description.ilike(searcher)); }; // The view lets you pass a null user_id, if you're not logged in