Skip to content

Commit

Permalink
search user autocomplete - match nicknames
Browse files Browse the repository at this point in the history
  • Loading branch information
slatinsky committed Nov 4, 2023
1 parent bfd838a commit d1dadc7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions backend/fastapi/Autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,18 @@ def autocomplete_users(guild_id: str, partial_user_name: str, limit: int):
print("collection_authors", collection_authors)

query = {
"names": {
"$regex": partial_user_name, "$options": "i"
}
"$or": [
{
"names": {
"$regex": partial_user_name, "$options": "i"
}
},
{
"nicknames": {
"$regex": partial_user_name, "$options": "i"
}
}
]
}
cursor = collection_authors.find(query, {
"names": 1,
Expand Down

0 comments on commit d1dadc7

Please sign in to comment.