Zend certified PHP/Magento developer

Apple Mail search only partially indexes my emails

Apple Mail search is only turning up some of the emails that fit my search query. This occurs with both keyword searches and searches for specific content.

It is particularly noticeable when searching through specific email folders: I would see emails that fit the search criteria – such as being sent by a specific person – in the list but the search would only turn up a few results. These results are often only very recent emails but could also include a few older emails.

This is probably a problem with the indexing but I have tried numerous solutions to no avail.

Some interesting observations:

  • If I manually scroll down and open an email that would fit my search query that did not appear in my search results before, it will not suddenly appear in them. So this is probably an indexing issue.

  • I notice this problem particularly badly occurring in nested folders – however, normal folders (like “sent”) are still affected

  • If I “search all mailboxes”, many of the emails I was looking for do pop up, but only because Mail finds them in “Archive” or “Important”

Things I’ve tried to fix this problem:

  • Use “rebuild mailbox”: nothing happens upon button press

  • Delete the Envelope files in the ~/Library/Mail/V9/MailData folder: index is rebuilt but mail search is still not working

  • SQL vacuum the envelope file: same thing happens

  • Rebuild Spotlight index by deleting it fully: that often changes the emails that are found but it doesn’t fix the problem

  • Rebuild Spotlight index by excluding and then including the email folder in the Privacy tab: doesn’t change anything

  • Deleting my email account in the Settings and setting it up again

(NB: I do use the GPG Suite with Mail but 99% of the emails aren’t encrypted – only signed – and the emails that show up do not differ in that regard from the emails that don’t show up)