Can’t search mail? Check spotlight plugins

For a few weeks I’d been unable to search through my mail, at least using the “whole message” filter in Apple Mail. For instance, if I entered a word that I knew was in a given mail body, the search would return nothing. I tried this hint from Apple, that explains how to re-build the “envelope index” file (whatever that is), but it didn’t work.
After experimenting for a while, I realized that searching on message subject was working fine. According to comments on macosxhints, it’s pretty normal: searching on subject, author and date is done by a regular lookup within Mail’s SQLite database, while full message body search is done via Spotlight. So both are unrelated.
Armed with this knowledge, I tried fiddling with the Spotlight preference pane, adding and removing the mail folder and emails. Didn’t work. So I tried to force a re-indexing of the Apple Mail folder :
mdimport -f ~/Library/Mail/Mailboxes
… which spewed tons of error messages! Ah-ha. The culprit was apparently a Spotlight plugin, which couldn’t find the associated executable. After some digging, it appeared that I had installed a MailTag 2.0 beta some time ago, and desinstalled it some time later. The Spotlight plugin had stayed in place, though (at ~/Library/Spotlight), and it was screwing up my Spotlight searches…
After removing the guilty plugin, everything now works as expected.

This entry was posted in Apple, Technology and tagged , , . Bookmark the permalink.