From 65145b719c342732d9d7c6f6376e3d4ebbed241e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 7 Feb 2020 11:17:15 -0500 Subject: [PATCH] Adding post body searching. Fixes #507 --- server/src/db/post_view.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/db/post_view.rs b/server/src/db/post_view.rs index c80d169..4d09308 100644 --- a/server/src/db/post_view.rs +++ b/server/src/db/post_view.rs @@ -178,7 +178,11 @@ impl<'a> PostQueryBuilder<'a> { pub fn search_term>(mut self, search_term: T) -> Self { use super::post_view::post_mview::dsl::*; if let Some(search_term) = search_term.get_optional() { - self.query = self.query.filter(name.ilike(fuzzy_search(&search_term))); + let searcher = fuzzy_search(&search_term); + self.query = self + .query + .filter(name.ilike(searcher.to_owned())) + .or_filter(body.ilike(searcher)); } self }