10 Replies Latest reply: Aug 10, 2011 6:59 PM by twtwtw
Rob Tholemeier Level 1 (100 points)

How do I get mail to re-index so I can search entire message?

  • Sonicray Level 4 (1,470 points)

    You can follow this:


    http://www.happymac.info/knowledge-base/tech-advice/80-cleaning-up-mails-envelop e-index.html



    You could also use apps like Onyx (free) or MainMenu Pro ($$)

  • Rob Tholemeier Level 1 (100 points)

    /usr/bin/sqlite3 ~/Library/Mail/Envelope\ Index vacuum


    Did not help. Maybe I was not clear. The Entire Message search choice in Mail is grey (not choosable).

  • twtwtw Level 5 (4,925 points)

    It sounds as though you've got the mail folder set to private in spotlight.  open System Preferences, go to the Spotlight pane, click the privacy tab, and make sure your mail folder (or Library folder) are not excluded.  If that's not it, you may be able to reindex your mail messages: open terminal and type mdimport -r /System/Library/Spotlight/Mail.mdimporter.


    P.s. fixed the command with the full path.

  • etresoft Level 7 (27,828 points)

    Try running "Rebuild" from the Mailbox menu.

  • Rob Tholemeier Level 1 (100 points)

    Hmm. I got this fixed. None of the advice above helped. Do NOT rebuild mailbox!! Do NOT use ONYX. Do NOT mess around in terminal.


    The thing that did work was: Use the Spotlight Preference Panel in Systems Preferences to indicate you do not want to index your hard drive. Then save that (by closing, rebooting, etc?). Then go back  and say you do not want to not index the hard drive).


    Here's how:


    Open Systems Preferences. Open the Spotlight Preference Panel.


    Under Privacy click "-" then drag your hard drive from your desktop to the window. If you look at it carefully it sort of makes sense. It is a double-negative.


    Then save it. Not sure how to do that but I hit helicopter-S & closed Systems Preference and re-booted. I also took my time and waited between each step - there seems to be some background process watching all this and you need to give it time to discover what you just did - tell Spotlight to not index your hard drive. I think it is deleting a file .Spotlight in the root directory. Not sure.


    Then I re-started.


    When the IPL completed. Spotlight cannot see the files in the hard drive. This is good.


    Then go back to the Spotlight Systems Preference and delete the entry under Privacy that indicates do not index the hard drive. By saying to not not index your hard drive you are saying to index your hard drive. Take your time. The background process needs to see that you made a change (not sure if this is necessary but for sure there is some background process managing the whole indexing metaphor).


    I went through save series again in the Spotlight Preference Panel to make sure that the background process was set. hilocopter-S, close Systems Preferences and open it up again just to make sure it was saved.


    Then did a restart.


    Ah, when the Mac came back the little magnifying glass icon upper right had a tick in the middle and when clicked upon it said the index was being re-indexed.


    I let it run over night and today I can use Entire Message search in Mail and the helicopter-F seems to find files.


    This is kind of kludgy but works. There are similar instructions around but they do not warn to go slow. If you move to fast or do not get a save of the changes in Spotlight Preference Panel it seems to not force a re-index.



    I miss the old Find File!! Such a hassle to look in the so-called system files. For real searching I use EasyFind, but for quick and dirty this will make a broken Spotlight go back to spec such as it is.

  • twtwtw Level 5 (4,925 points)

    lol - so in other words, I was right, you just didn't want to use Terminal.  fair enough. 

  • Rob Tholemeier Level 1 (100 points)

    No, the terminal did not work. I think I know why but not sure.

    mdimport -r /System/Library/Spotlight/Mail.mdimporter.

    Through IO errors. I think ONYX had the rebuild underway but the little tick in spotlight icon did not show and the USB/FW drives remained indexed. ONYX removed the MacHD index only. If I get it right (not sure) each drive has a .Spotlight file and Spotlight thinks things are OK if there are any. Not sure.


    "It sounds as though you've got the mail folder set to private in spotlight." NOPE. Better to "ask" than assume.


    I use terminal for time to time. Comfortable with Unix and shell. Your assumption that I did not want to use terminal is in error, also. You should not "assume". There is a ditty about that running around.


    This worked.

  • twtwtw Level 5 (4,925 points)

    Yes, it would work - I was just trying to save you the time of reindexing the entire drive (an obvious case of over-engineering on my part ). 


    and I wasn't asking or assuming, I was suggesting.  temper-temper!

  • opaekaa Level 1 (0 points)

    I tried your suggestion, and the command didn't come back with an error, but it came back way too fast for what I thought it was doing (re-indexing), so I tried another command to print out the results:


    mdimport -rp /System/Library/Spotlight/Mail.mdimporter


    And got the following:


    Total processing time spent in importer plug-ins: 0.000000 seconds for 0 files

    Top 0 most expensive files for importer plug-ins:


    Am I missing something?

  • twtwtw Level 5 (4,925 points)

    My guess would be that your email is already completely indexed.  mdimport is checking the current files against its database, seeing that nothing needs to be done, and aborting.