]> Untitled Git - lemmy.git/commitdiff
Adding community title and description searching. Fixes #589
authorDessalines <tyhou13@gmx.com>
Sun, 8 Mar 2020 23:14:52 +0000 (19:14 -0400)
committerDessalines <tyhou13@gmx.com>
Sun, 8 Mar 2020 23:14:52 +0000 (19:14 -0400)
server/src/db/community_view.rs

index 18ff67a8a014afd005933d88bde829c29ef5c816..f24c922c397db237173a4e3c04222899f675e6dc 100644 (file)
@@ -180,7 +180,11 @@ impl<'a> CommunityQueryBuilder<'a> {
     let mut query = self.query;
 
     if let Some(search_term) = self.search_term {
-      query = query.filter(name.ilike(fuzzy_search(&search_term)));
+      let searcher = fuzzy_search(&search_term);
+      query = query
+        .filter(name.ilike(searcher.to_owned()))
+        .or_filter(title.ilike(searcher.to_owned()))
+        .or_filter(description.ilike(searcher));
     };
 
     // The view lets you pass a null user_id, if you're not logged in