Search box finds nothing unless I clear every field except "body"
@GretaD is already working on this.
Since Jun 17, 2026.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Steps to reproduce
If I type a word in the search box above the message list, I get zero results,
even when I'm staring at a message that clearly contains that word in its body.
The only way I found to make it work: open the advanced search panel, delete the
word from Subject, From and To by hand, and leave it only in Body. Then the
message shows up. So the search box is basically unusable as-is.
I have "Enable mail body search" turned on for the account, and my IMAP server
(Dovecot with flatcurve) does have a working full-text index. doveadm search
on the server finds the message by body just fine, so this is on the Mail app side.
Steps to reproduce
- Enable "Enable mail body search" on an account.
- Open a folder.
- Search for a word that's in the body of a message but not in its subject,
sender or recipient. - Nothing comes up.
- Open advanced search, remove the word from Subject / From / To, keep it only
in Body, search again -> the message is found.
Expected behavior
Typing one word in the search box should find messages that have that word in any
field (subject, sender, recipient or body). A plain OR.
Actual behavior
The search box puts the same word into Subject, From, To AND Body at once, and then
combines them with AND. So it ends up asking for a message where the word is in the
sender AND the recipient AND (subject OR body) all at the same time, which never
happens for a normal email.
Mail app version
5.9.2
Nextcloud version
33.0.3
Mailserver or service
IMAP: Dovecot (Mailcow) + flatcurve FTS (mailcow)
Operating system
AIO
PHP engine version
None
Nextcloud memory caching
No response
Web server
None
Database
None
Additional info
Where it comes from (I went digging)
- The quick search fills every field with the same query:
searchInSubject = query,
searchInFrom = [{email: query}],searchInTo = [{email: query}],
searchInMessageBody = searchBody ? query : null. - The default match mode is
allof(AND):SearchQuery.phphas
private string $match = 'allof';, and the frontendresetFilter()sets
this.match = "allof". - In
MessageMapper::findIdsByQuery(), withallof, From and To each become their
ownandWhere(...), while Subject and Body are OR'd together. Net result is
From~term AND To~term AND (Subject~term OR Body~term).
Switching the single-term search to anyof would put all four into the OR group and
fix it. allof only makes sense in the advanced panel when you fill different fields
with different values.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.