Issue Description
JMAP Email/query with subject filter (and header filter on Subject) does not find the tag in square brackets at the start of Subject. Rest of the subject is searchable.
I have 5 emails in one mailbox, all with subject [GitHub] Payment Receipt for mrwogu. Sieve puts them in this mailbox, that works fine. I query this mailbox with inMailbox plus one more condition:
| Condition | Total |
|---|---|
subject: "GitHub" |
0 |
subject: "github" |
0 |
subject: "[GitHub]" |
0 |
header: ["Subject", "GitHub"] |
0 |
subject: "Payment Receipt" |
5 |
subject: "Payment" |
5 |
subject: "mrwogu" |
5 |
text: "GitHub" |
5 |
| no extra condition | 5 |
text matches I think only because GitHub is also in From and body. No config changes on my side around search or indexing. My guess is subject is indexed after base subject normalization from RFC 5256, which strips list tags like [list]. Ok for threading, but not for search. I tested only with [GitHub] tag, not others.
Expected Behavior
RFC 8621 section 4.4.1 (RFC 8621: The JSON Meta Application Protocol (JMAP) for Mail | RFC Editor):
subject looks for the text in the Subject property,
header with [name, value] matches if the header field contains the value.
Subject is [GitHub] Payment Receipt for mrwogu, so subject: "GitHub", subject: "[GitHub]" and header: ["Subject", "GitHub"] should all return the 5 emails.
Actual Behavior
All three return 0 results. Other words from the same Subject (Payment, Payment Receipt, mrwogu) return 5. So only the leading bracket part is not searchable, in any form.
Reproduction Steps
- Deliver a few emails with subject
[GitHub] Payment Receipt for mrwoguinto one mailbox. - Get the mailbox id with
Mailbox/get. - Run:
{
"using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
"methodCalls": [
["Email/query", {
"accountId": "<account id>",
"filter": { "operator": "AND", "conditions": [
{ "inMailbox": "<mailbox id>" },
{ "subject": "GitHub" }
]},
"calculateTotal": true
}, "0"]
]
}
totalis 0.- Change
{ "subject": "GitHub" }to{ "subject": "Payment" }.totalis 5. { "header": ["Subject", "GitHub"] }also gives 0.
Stalwart Version
v0.16.x
Installation Method
Binary (Linux)
Database Backend
FoundationDB
Blob Storage
Filesystem
Search Engine
Internal
Directory Backend
Internal
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