Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Lion Mail and Worthless/Failing Searches

I've been on the beta/GM for a while now but cannot figure out why searching within Mail is generally broken for me.


Problem visualized below in the screenshots. I have a bunch of mail accounts, all of which work nicely. As you can see, there are some emails in view. If I type a full word into the search field, click the "Message contains "Mixpanel" suggestion (which we plainly can see is in the first message listed), I get no results at all. I've tried changing every selectable option I can and nothing will result in actually finding messages.


Searching for partials sometimes works, and choosing the auto suggestions for specific "People" seems to work but not full word searching. I'm stumped.


User uploaded file

User uploaded file

Posted on Jul 21, 2011 8:48 AM

Reply
83 replies

Aug 4, 2011 1:02 AM in response to xmetal280

Same situation for me. My spotlight is not working properly since iv'e upgradet to lion. I've tried all the above mentioned workarounds but no trick helped me resolving the problem.


If I add my harddrive to the privacy area of spotlight in the preferences > close the prefs > reopen the prefs, than the harddrive does not appear anymore...


Sometimes it is even not possible to add the harddrive to spotlights privat section > system is saying failure.


So my basic problem is that spotlight does not even start with the indexing.


Does anyone have a idea how to proceed?


Thx

Aug 4, 2011 3:11 AM in response to da_re

Hi there - the best, most precise, thing to do is use the mdutil command. This requires you to run commands in Terminal, and to run them as root.


** Standard disclaimer **

Be very careful running commands as root on your Mac (which is essentially a Unix machine) the root user has full access and can do anything on your machine. You can, if you are not careful, and/or don't know what you are doing, damage your machine.


Let me say that again - if you do this below you will run commands on the root (/) folder of your computer. If you do things incorrectly you potentially could wipe/damage the whole Macintosh HDD. That would be worse than a 'bad hair' day. It is completely up to you - no liability accepted (this is all meant to make you be very careful 😉).


Start a terminal session on your Mac, below you will see various commands, the commands and display in Terminal program are shown as fixed length font, the instructions as this type of font in italics preceeded by a number.


Note:

  • you type the text after the prompt which will be usually the '$'. So if the line below says "iMac:/ $ cd /" you type only "cd /"
  • command line switches like -E ; -i ; -s are CaSe sensitive.


Reference sites:


http://www.thexlab.com/faqs/stopspotlightindex.html


http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/ man1/mdutil.1.html


===============================


1) Go to root of drive

iMac:/ $ cd /


2) Show which folder you are in

iMac:/ $ pwd

/


3) Change to the 'Volumes' folder

iMac:/ $ cd Volumes/


4) Check it

iMac:Volumes $ pwd

/Volumes


5) List contents of folder - see that Macintosh HD is an alias pointing to '/' the root folder of Mac

iMac:Volumes $ ls -la

total 8

drwxrwxrwt@ 3 root admin 102 Aug 4 07:27 .

drwxr-xr-x 31 root wheel 1122 Jul 31 23:54 ..

lrwxr-xr-x 1 root admin 1 Aug 4 07:27 Macintosh HD -> /


6) List options for mdutil command. First, being safe, first we will see what is set for drive.

iMac:Volumes $ mdutil

Usage: mdutil -pEsa -i (on|off) -d volume ...

Utility to manage Spotlight indexes.

-p Publish metadata.

-i (on|off) Turn indexing on or off.

-d Disable Spotlight activity for volume (re-enable using -i on).

-E Erase and rebuild index.

-s Print indexing status.

-a Apply command to all volumes.

-V vol Apply command to all stores on the specified volume.

-v Display verbose information.

NOTE: Run as owner for network homes, otherwise run as root.


7) Run command as root using the sudo option (special command which runs another command as root)

iMac:Volumes $ sudo mdutil -s /


WARNING: Improper use of the sudo command could lead to data loss

or the deletion of important system files. Please double-check your

typing when using sudo. Type "man sudo" for more information.


To proceed, enter your password, or type Ctrl-C to abort.


Password: [at this point enter your account password]

/:

Indexing enabled.


iMac:Volumes $


8) Note re: the above - this will NOT show if specific (sub)folder on drive has had indexing turned off via System Preferences.
Then IF indexing is turned off (for whole HDD volume) turn it on

iMac:Volumes $ sudo mdutil -i on /


9) Run command to (totally) erase and rebuild index - obviously only do this if indexing is turned on - to see if this fixes your issue.

iMac:Volumes $ sudo mdutil -E /


===============================


Good luck! If the above does not get your machine's Spotlight indexing working properly you may need to take your machine to Apple and/or Apple authorised repair company.

Aug 4, 2011 5:58 AM in response to FromOZ

Thank you FromOZ


I've tried for 2.5 h together with our admin (very skillful in unix) to solve the problem > mission failed.


Once in a while we can force spotlight to start building up an index via the terminal but after some minutes spotlight finishes. It is not clear why and it does, we can't find any reports in the console...


I'm able to add my backup disc to the 'privacy area' of spotlight in the preferences. I'm also able to add my harddisc or the programms-folder, but after closing the preferences and re-opening my harddisc and programm-folder are removed.


Seems to me like a serious problem - hopefully apple will take on this topic an provide a solution or an update.

Aug 4, 2011 5:03 PM in response to da_re

I would love to say I have good news but unfortunately not! After spending 3 hours on the phone with apple care trying to fix this on my machine i had to do a full clean install of Lion and now the problem is fixed and searching is fine.


Massive let down on apples part and this is simply not good enough! First real negative experiance with macs and a BIG ONE!!

Aug 5, 2011 4:43 AM in response to da_re

Shame.


Always when upgrading operating systems there is statistically a risk that a certain number of upgrades will not go smoothly. If one looks at the number of people who purchased/upgraded Lion then statistically the failures are low.


But I don't like being a 'statistic' — I always do clean installs for major new releases and then copy over my stuff piece by piece. Never had any issues, and I can also toss old junk which has accumulated on the machine.


I would be encouraging you to do a clean install on new drive and then copy over apps and data.


Anyway good luck!

Aug 6, 2011 11:18 PM in response to xmetal280

Hey Guys,


Had the same problem here... None of the previous solutions in this thread worked for me, but I was able to resolve my issue with "sudo mdutil -i on /Users/", rahter that just "sudo mdutil -i on /" mentioned earlier. Not sure if this will help anyone else or if my problem was unique, but I figured it was worth mentioning.


-Sam

Aug 8, 2011 6:50 PM in response to xmetal280

Both Spotlight and the search in Mail 5.0 were broken for me. While searching for known material, I would get blank results.


I did a clean install and everything is working perfectly. FWIW, this is on a 2011 Mac Mini Server.


I tried all of the suggestions recommended on these forums and none of them worked. The clean install, while timely, did the trick.

Aug 9, 2011 9:22 PM in response to UCF Sam

I was pulling my hair out with this one until reading UCF's command. While this exact command didn't work for me it put me on the right track. I have file vault installed so the command I had to run was as follows:


sudo mdutil -i on /Users/username


After that (and removing and re-adding my mail accounts) they indexed just fine. Thanks!

E

Aug 10, 2011 10:27 AM in response to xmetal280

I created a thread about the search problem after Lion installation before discovering this thread. I'll post the solution to my problem, which may or may not be the same as or solve yours.


Just off the phone after a long stint with Apple support about this.


Spotlight could find the message files (unlocateable by search within Mail). Files that were cached on the POP server (for a month) were searchable, but those stored on the Mac were not.


The tenacioius (A+) Apple support tech traced the problem to the file User > Library > Mail > V2 > MailData > Envelope Index. He had me close Mail, drag Envelope Index to the desktop, and restart Mail, which acted as though it were being opened for the first time. I clicked Continue (I think it said) and Mail restored all of the messages and settings (whew!). When it was done I closed Mail and reopened. Again I had to click through as if it were the first time, and then the messages appeared. It took several minutes for Mail to reindex the messages, which it does independently from Spotlight. It now appears to search properly.

Aug 11, 2011 3:52 AM in response to xmetal280

@ Satchmo


I've did what you suggested but it did not work out. Everything worked exaktly the way you'd discribed it except of the fact, that afterwards the search is still corrupt. Mail can find people from my adressbook but no subjects or informations from the emails itselfe. Obviously mail needs spotlight for that, what sill is not working for me...

Lion Mail and Worthless/Failing Searches

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.