From: Dessalines Date: Fri, 7 Feb 2020 16:17:15 +0000 (-0500) Subject: Adding post body searching. Fixes #507 X-Git-Url: http://these/git/%22%7B%7D/static/git-favicon.png?a=commitdiff_plain;h=b6fceec6dd59403e46b80e8139081243e65a077d;p=lemmy.git Adding post body searching. Fixes #507 --- diff --git a/server/src/db/post_view.rs b/server/src/db/post_view.rs index c80d1696..4d09308d 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 }