Skip to content

Commit d39ecd1

Browse files
authored
Add ap_id to the fuzzy searching for community and person. (#6502)
- I tested this, and fuzzy queries do somewhat work, like "lemmy.ml/c/world", "lemmy.world/c/world" will correctly filter the instance for world news. - Fixes #6374
1 parent 81047a3 commit d39ecd1

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

crates/db_views/community/src/impls.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ impl CommunityQuery<'_> {
198198

199199
let name_or_title_filter = community::name
200200
.ilike(searcher.clone())
201+
// Also include the ap_id to allow for instance searching
202+
.or(community::ap_id.ilike(searcher.clone()))
201203
.or(community::title.ilike(searcher.clone()));
202204

203205
query = if self.search_title_only.unwrap_or_default() {

crates/db_views/person/src/impls.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ impl PersonQuery<'_> {
155155

156156
let name_or_title_filter = person::name
157157
.ilike(searcher.clone())
158+
// Also include the ap_id to allow for instance searching
159+
.or(person::ap_id.ilike(searcher.clone()))
158160
.or(person::display_name.ilike(searcher.clone()));
159161

160162
query = if self.search_title_only.unwrap_or_default() {

0 commit comments

Comments
 (0)