Skip to content

Commit

Permalink
add fulltext search for embeds.title and embeds.description
Browse files Browse the repository at this point in the history
  • Loading branch information
slatinsky committed Nov 4, 2023
1 parent a1a4f98 commit 44a6551
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion backend/fastapi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,28 @@ async def search_messages(guild_id: str, prompt: str = None, only_ids: bool = Tr
if len(message_contains) > 0:
and_ = []
for message_should_contain in message_contains:
and_.append({"content.content": {"$regex": message_should_contain, "$options": "i"}})
and_.append({
"$or": [
{
"content.content": {
"$regex": message_should_contain,
"$options": "i"
}
},
{
"embeds.title": {
"$regex": message_should_contain,
"$options": "i"
},
},
{
"embeds.description": {
"$regex": message_should_contain,
"$options": "i"
},
},
]
})

query["$and"].append({"$and": and_})

Expand Down

0 comments on commit 44a6551

Please sign in to comment.