Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Repair broken full-message search in Mail Apps
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:
  • Searching for a word that clearly appears within the body of a message returns 0 results.
  • Selecting From, To or Subject as a specific search criteria will yield results for their respective fields, but Entire Message will not.
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.
    •    
  • Currently 3.86 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[36,097 views]  

Repair broken full-message search in Mail | 15 comments | Create New Account
Click here to return to the 'Repair broken full-message search in Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Repair broken full-message search in Mail
Authored by: kyngchaos on Feb 08, '08 09:30:36AM

Sometimes, on Leopard at least, Spotlight gets disabled with ".metadata_never_index". I haven't figured out why, it just happens. Using mdutil to turn Spotlight on for a disk doesn't work then.

You may need to delete this file on the disk's root:

sudo rm /.metadata_never_index

Then turn on Spotlight with mdutil.



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: kyngchaos on Feb 08, '08 09:44:47AM

Oh yeah, prefix the path with the correct "/Volumes/disk_name" as used in the original hint, if it's not the boot disk.



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: joshturse on Feb 09, '08 05:51:18PM
When I type in "sudo mdutil -i on /", the reply from the terminal is
/:

Indexing disabled.

That doesn't (didn't) seem right, so I "sudo rm /.metadata_never_index" and tried again, with the same response. Is this what I'm supposed to see?

[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: barthex on Feb 12, '08 02:11:30AM

Anything that start with "sudo" and is followed by "rm" is the equivalent of letting your three year-old kid fumble with a loaded gun.

Adding "/" after is the equivalent of showing him the trigger.

He might not hurt himself, he might not hurt you, but he COULD hurt anyone.

Please do no play with "sudo rm" unless you understand what it could do.
It is a command that will delete in a non-recuperable way the files that are concerned (and "/" attacks the top level of your disk. Shiny.)

I wish comments were subject to filtering when the "sudo rm" string appears!

Just a word of caution, not a scorn on unix beginners (I am one meself, and that is a quite importanrt lesson I was glad to be given)



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: tc_nyc on Feb 08, '08 10:39:25AM
I found this thread very helpful: Apple Discussion

In particular, I found that reindexing just the mail folder using this command mdimport ~/Library/Mail worked much faster than reindexing my entire hard drive.

YMMV, of course

[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: Gregory on May 15, '08 09:24:21AM

rebuilding the whole index didn't work for me.

explicitly importing the Mail folder did however work. thank you. I finally have whole-message searching back after who knows how many weeks without it.



[ Reply to This | # ]
Search for partial words in the middle?
Authored by: TF on Feb 08, '08 11:10:48AM

You have a topic that I have been wondering about for a long time: Even when Mail searches all the text, it matches "amplify" and not "lamp". Is there a way to change this behavior and make it find both? Another hint I missed?
TIA.



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: jwz on Feb 08, '08 11:36:52AM
You can just use / instead of "/Volumes/Macintosh HD". They're the same thing.

[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: rhowell on Feb 09, '08 07:06:56AM

Re-indexing can be accomplished in System Preferences->Spotlight->Privacy, and doesn't require visiting the command line.



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: kajama on Feb 09, '08 07:49:29AM

2 days ago i turned on File Vault on Leopard and found that full search problem. Tried to rebuild spotlight but useless. Turned off File Vault and voile! Search now is working. Could it be because of file vault?



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: Notch Johnson on Feb 09, '08 08:50:35PM

Wouldn't doing Mail-->Mailbox-->Rebuild fix this problem?



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: jegelie on Feb 10, '08 11:47:10AM

Yes, it has something to do with File Vault. I had this problem too using File Vault on an account.

I tried everything I could google up, but to no avail. Even at various fora one couldn't help out.
Then I tried shutting off File Vault. Searching worked again.
Then I turned File Vault on again. Searching still works, up to today. The issue happened about a year ago...

So even if you're not on File Vault - trie turning it on and off again. It could do that chicken-voodoo-magic trick on Spotlight making it work again.



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: minniger on Feb 21, '08 01:24:45PM

I just went through this... the only thing that worked was to use the Spotlight privacy control panel.

Add the ~/Library/Mail to it. Nav away from the panel. Go back and then remove the ~/Library/Mail entry. Spotlight then reindexs the Mail and the Full-Message option is enabled after the index run.





[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: Anim8me2 on May 09, '08 03:46:13PM

I have tried everything suggested here as well as the forums at apple.com.
I am getting errors in Terminal that my index does not exist. I have even tried going to the .spotlight-v100 folder and deleting the index files there. Spotlight would start indexing and afterwards still nothing.
I also tried using *censored*tail and it reported a problem with the permission os mdutil so I chmod the permissions but... bupkis!
I am at the end of my rope here.



[ Reply to This | # ]
Repair broken full-message search in Mail
Authored by: macbikegeek on Dec 17, '09 09:09:37AM

Thank you for this! Re "Hope this saves someone some pain.", my pain has been relieved. Rebuild of index did the trick and Search Entire Message now works again!



[ Reply to This | # ]