Adding post body searching. Fixes #507
This commit is contained in:
parent
214c1d3fd1
commit
b6fceec6dd
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