mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 19:31:33 +00:00
Adding post body searching. Fixes #507
This commit is contained in:
parent
68ac96147c
commit
65145b719c
1 changed files with 5 additions and 1 deletions
|
@ -178,7 +178,11 @@ impl<'a> PostQueryBuilder<'a> {
|
||||||
pub fn search_term<T: MaybeOptional<String>>(mut self, search_term: T) -> Self {
|
pub fn search_term<T: MaybeOptional<String>>(mut self, search_term: T) -> Self {
|
||||||
use super::post_view::post_mview::dsl::*;
|
use super::post_view::post_mview::dsl::*;
|
||||||
if let Some(search_term) = search_term.get_optional() {
|
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
|
self
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue