Repair broken full-message search in Mail

Feb 08, '08 07:30:02AM

Contributed by: asqui

Occasionally in both Mac OS 10.4 and 10.5, Mail may no longer be able to search message body contents using the small search filter box in the top right of the application. This can be very painful if you have a lot of email, even if you have set up many filters and folders, and even more so if you make use of the Smart Folder features.

Symptoms:

The reason that you can search From, To, and Subject is that those searches do not use Spotlight, while Entire Message is powered by Spotlight. So if you've disabled Spotlight, then you've disabled full-text email searching. Keep in mind that Spotlight indexes what it considers whole words and will only match using the left-most prefix -- searching for amp will match the word amplify but not lamp.

The problem you are getting is either because S1potlight has been disabled, or the index is broken and needs to be rebuilt. Try the following... First, make sure Spotlight is enabled for the volume/mount where your email resides. In Terminal, do this: sudo mdutil -i on "/Volumes/Macintosh HD". Replace Macintosh HD with the volume name. Try the search in Mail now -- if it still fails, then you can try rebuilding the index. Still in Terminal, run sudo mdutil -E "/Volumes/Macintosh HD" (replacing Macintosh HD again).

This will simply erase the local store of indexes for the volume, and provided that Spotlight is enabled for the volume (which it should be from above), it will immediately begin to reindex. You should notice the Spotlight icon on the Mac OS menu bar up the top telling you that it is reindexing your drive if you click on it. Wait for that to complete and then you should be able to search your mail again.

If you are still having troubles, jiggle the cable, turn off, wait five seconds, turn on again, sacrifice a chicken, or try whatever else you usually do when things inexplicably stop working, because you're on your own now.

Hope this saves someone some pain.

Comments (15)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080201111317585