Issue Description
When using the Meilisearch backend, searching stalwart for a message scoped to a specific field returns messages matching the query in any field.
Expected Behavior
Searches scoped to a specific field only return matches on that field.
Actual Behavior
Searching on "from": "[email protected]" returns every message where [email protected] appears in any searchable field (from, to, cc, subject, body, etc.), instead of only the messages where [email protected] is in the from field.
Reproduction Steps
- Configure stalwart with meilisearch backend.
- Send a message from
[email protected]to a stalwart mailbox. - Send a message from
[email protected]to the same stalwart mailbox, with[email protected]in another part of the message (to,cc,subject,body, etc). - Search for messages
"from": "[email protected]"in the mailbox using curl/jmap. - Both messages appear in the result set, instead of just the first.
Stalwart Version
v0.16.x
Installation Method
Binary (Linux)
Database Backend
RocksDB
Blob Storage
Filesystem
Search Engine
Meilisearch
Directory Backend
Internal
Additional Context
Meilisearch recognizes an attributesToSearchOn in its query parameters, but stalwart never seems to set this anywhere in crates/store/src/backend/meili/search.rs.
Instead, build_query seems to drop the target field for text conditions, merging from/to/cc/subject/body into one shared q. query() then sends that q without any attributesToSearchOn, so it searches all searchable attributes.
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on