Don't search for community descriptions, search for user display_name. (#2430)

- https://github.com/LemmyNet/lemmy-ui/issues/756
This commit is contained in:
Dessalines 2022-09-07 04:58:41 -04:00 committed by GitHub
parent 265dc54627
commit 3f2a689edf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -140,8 +140,7 @@ impl<'a> CommunityQuery<'a> {
let searcher = fuzzy_search(&search_term); let searcher = fuzzy_search(&search_term);
query = query query = query
.filter(community::name.ilike(searcher.to_owned())) .filter(community::name.ilike(searcher.to_owned()))
.or_filter(community::title.ilike(searcher.to_owned())) .or_filter(community::title.ilike(searcher));
.or_filter(community::description.ilike(searcher));
}; };
match self.sort.unwrap_or(SortType::Hot) { match self.sort.unwrap_or(SortType::Hot) {

View file

@ -70,7 +70,10 @@ impl<'a> PersonQuery<'a> {
.into_boxed(); .into_boxed();
if let Some(search_term) = self.search_term { if let Some(search_term) = self.search_term {
query = query.filter(person::name.ilike(fuzzy_search(&search_term))); let searcher = fuzzy_search(&search_term);
query = query
.filter(person::name.ilike(searcher.to_owned()))
.or_filter(person::display_name.ilike(searcher));
} }
query = match self.sort.unwrap_or(SortType::Hot) { query = match self.sort.unwrap_or(SortType::Hot) {