# Heads up Mail search/Spotlight mail search problem



## MacDoc (Nov 3, 2001)

We given my volume of mail - mail searches are critical to me.

I've been wrestling for a week or so with what I thought was a minor maintenance hiccup but which *appears to be a serious bug in Leopard for those that are heavy mail users.*

After muddling about myself I decided a search was i order and quite a few have the same problem and so far there appears no complete solution. 

A google on *Leopard's Spotlight doesn't search Mail messages* gets lots of hits 

Apple - Support - Discussions - Mail Won't Search ...

Apple - Support - Discussions - Spotlight does not search Mail messages ...

Initially neither Spotlight nor Mail would find info inside Mail messages.
I was finally able to get a partial solution from this thread so that Spotlight works and Al Mailboxes works but the critical one for me INbox search is still MIA.

Apple - Support - Discussions - Leopard's Spotlight doesn't search Mail ...

This was the key step but* PLEASE DO CURRENT CLONED BACKUP FIRST*



> Enter the following line in the terminal to have Spotlight import your messages:
> 
> mdimport ~/Library/Mail


Once this rebuild occurred ( it took a long time with my mail structure ) then Spotlight was fine and All Mailboxes was fine.

Still no luck on InBox find

Just to make this clear here is the problem in Mail

*Click on All mailboxes - up pops the items*










*Click on Inbox - nothing even tho obviously a couple of the messages are current.*










Go to Spotlight and there they are tho this was not the case when I started this rigamarole. 











It also appears from one poster that you have to repeat the*mdimport ~/Library/Mail* command whenever new mail is added  

something busted and *DO PLEASE look at the threads before suggesting solutions as dozens of people well versed have come up empty handed.*

Here's a rather complete list of the topics

Topic : Spotlight does not search Mail messages
Apple - Support - Discussions - Spotlight does not search Mail messages ...
Topic : Search "Entire Message" returns "0 Found" in mailboxes
Apple - Support - Discussions - Search "Entire Message" returns "0 ...
Topic : Spotlight died on me
Apple - Support - Discussions - Spotlight died on me ...
Topic : I can't search through my inbox!
Apple - Support - Discussions - I can't search through my inbox! ...
Topic : Leopard's Spotlight doesn't search Mail messages
Apple - Support - Discussions - Leopard's Spotlight doesn't search Mail ...
Topic : Mail Search
Apple - Support - Discussions - Mail Search ...
Topic : Mail Won't Search
Apple - Support - Discussions - Mail Won't Search ...
Topic : Search does not work
Apple - Support - Discussions - Search does not work ...
Topic : Mail search not working
Apple - Support - Discussions - Mail search not working ...
Topic : Unable to Search Mailbox
Apple - Support - Discussions - Unable to Search Mailbox ...
Topic : Why is Search in Mail.app busted?
Apple - Support - Discussions - Why is Search in Mail.app busted? ...
Topic : Mail Search comes up empty
Apple - Support - Discussions - Mail Search comes up empty ...
Topic : Search "Entire Message" not working with Smart Mailboxes?
Apple - Support - Discussions - Search "Entire Message" not working ...
Topic : Mail searches yield no results! Smart mailboxes also yield no results!
Apple - Support - Discussions - Mail searches yield no results! Smart ...
Topic : 10.5.2 Mail.app search still not working (Entire Message)
Apple - Support - Discussions - 10.5.2 Mail.app search still not ...

Obviously, something is broken.


----------



## PierreB (Mar 5, 2007)

*Mail search*

What I have resorted to doing when what I want is in mail, is doing the search in the mail program. Seems to work fine when you do that - hope they fix spotlight soon as this is annoying.

EDIT: Removed Quote in order to help readability of thread. No original content was harmed in the amputation. ;-)


----------



## MacDoc (Nov 3, 2001)

Um can you remove the quote - it's unneeded and confusing thanks. Just leave the comment.


----------



## kockgunner (Sep 25, 2007)

sorry i have nothing to contribute, but i hate it when people quote whole opening posts especially when they are long and already confusing. You're in the thread, we know who you're replying to already!


----------



## PosterBoy (Jan 22, 2002)

I wonder how many of the users experiencing problems are diddling with anything they ought not to be, because on my Leopard machine it finds mail messages just fine based on content.

I wonder what is causing the issues?


----------



## Pelao (Oct 2, 2003)

I am with PB - thousands of messages across several accounts and folders and Spotlight finds what I want based on content without issue. I wonder what the differences are between my Mail and the problem ones.


----------



## MacDoc (Nov 3, 2001)

That is what people are puzzling about - some have delved in pretty deeply with no success.

I mean on mine it works in Spotlight now, works in All Mailboxes but not in inBox - and that seems to be the main bug. 
It almost seems to be some property of the inBox.

That said there have been pretty continuous reports of Spotlight having incomplete searches and Spotlight and Mail are harnessed together in the OS so perhaps it's some directory issue.

I noticed the V100 folder for Spotlight cannot be modified even with a permission change and Spotless mentions the V100 getting corrupted.

Maybe I'll try a migration just for clarification.
Archive and install did NOT repair the problem.


----------



## PosterBoy (Jan 22, 2002)

MacDoc said:


> I mean on mine it works in Spotlight now, works in All Mailboxes but not in inBox - and that seems to be the main bug.
> It almost seems to be some property of the inBox.


But it works 100% for me.



MacDoc said:


> I noticed the V100 folder for Spotlight cannot be modified even with a permission change and Spotless mentions the V100 getting corrupted.
> 
> Maybe I'll try a migration just for clarification.
> Archive and install did NOT repair the problem.


You're didling with the ".Spotlight-V100" folder? The hidden folder you're not really supposed to be diddling with? See, this is what i am wondering: What other diddling might the people experiencing problems be doing?

It's odd that an archive and install might not solve the problem, but then again there are a lot of things that archive and install doesn't replace.


----------



## MacBookPro (Jun 22, 2006)

I have never had a problem and I have 11, 740 mail messages stored.

One thing I DON'T have is almost 3000 messages in my Inbox! Wowzers!

Has this been investigated as a potential reason for the problem. I don't think Apple envisioned this "style" of housekeeping....


----------



## MacDoc (Nov 3, 2001)

> You're didling with the ".Spotlight-V100" folder? The hidden folder you're not really supposed to be diddling with? See, this is what i am wondering: What other diddling might the people experiencing problems be doing?


oh spare me  - did you actually read the links or just being a puerile nuisance as usual.

I could care less if it works 100% for you a single anecdote when many others have the identical issue is meaningless and unhelpful....like your post.

••••••

It has nothing to do with volume and 3,000 messages is less than 30 days volume for me.
My mailboxes are broken up every two months and go back to 2003.
There has been some issues reported with individual mailboxes with much higher numbers.

I can also confirm that the indexing fails to refresh so that new posts after the repair procedure do not show up in any search by content.

I'll run mdimport ~/Library/Mail again and I suspect the current ones will be there to find.


----------



## MacBookPro (Jun 22, 2006)

MacDoc said:


> It has nothing to do with volume and 3,000 messages is less than 30 days volume for me.


Double Wowsers! I'll no longer complain about being swamped by email - a mere ripple in a pond compared to your volume.

Well, that takes care of my "idea"! You seem to have all your ducks in a row.

This is obviously something Apple has to address...


----------



## chas_m (Dec 2, 2007)

I don't think it has anything to do with the number of emails in one particular box (InBox or otherwise), but the puzzling thing is that it's inconsistent. My spotlight finds work fine across all mailboxes, and I get at least 100 messages a day so I daresay I'm in the same "league" as MacDoc.

A dumb suggestion maybe, but have you ever tried to rebuild the envelope index using VacuumMail or some program like it?

I do this periodically. Doesn't hurt, might help.


----------



## PosterBoy (Jan 22, 2002)

MacDoc said:


> oh spare me  - did you actually read the links or just being a puerile nuisance as usual.
> 
> I could care less if it works 100% for you a single anecdote when many others have the identical issue is meaningless and unhelpful....like your post.


For someone who spends so much work time on the internet I'm surprised you've never picked up in the fact that the majority of the people who post on the internet are the ones with problems, while the ones without just go on their merry way.

Plus, there are at least two others in this thread so far who've said they have no problems.

And besides all that, has anyone even looked into what kind of diddling/etc the people experiencing problems might have in common? You've readily admitted to diddling with the spotlight index folder and it's contents, what else have the others been doing?

That you don't want to examine that as a possible common thread (or that you just don't want to hear it from me) doesn't mean that it isn't a possible explanation.


----------



## MacDoc (Nov 3, 2001)

Take a hike your pontification is doltish and typical for you. Some people have a problem with this period if you have nothing cogent to add to its solution then get lost. Your juvenile sulleness is wearisome.

••
Chas
All of the those - that was one of the first things. 

Well an install and migration seems to have fixed it for now tho oddly for the first couple of minutes it did not then all of a sudden it kicked in.

Very odd behavior.

Going to clone it.


----------



## PosterBoy (Jan 22, 2002)

MacDoc said:


> Take a hike your pontification is doltish and typical for you. Some people have a problem with this period if you have nothing cogent to add to its solution then get lost. Your juvenile sulleness is wearisome.


So far I've not belittled the issue or denied that you're experiencing it. I've only asked fairly simple questions: is there any common diddlage between those experiencing issues? Has anyone even looked into it?

So far you've only avoided the question and called me names.

So tell me, why is it you seem to take everything I say as a personal attack? Why is it you respond to everything I say with such hostility? Are you still holding a grudge? Because I'm tired of it. You don't have to like me, lord knows I've never been your biggest fan, but that doesn't mean you can't be civil.


----------



## Chealion (Jan 16, 2001)

Does resetting Spotlight's search database fix this? (Instead of manually telling Spotlight to index the Mail folder)

The command:

```
sudo mdutil -E /
```
Erases your current Spotlight database and will cause it to rebuild. I know on my 12" PB in Tiger I ran it every once in a while for some reason or another. I've never had to run in on my MBP with Leopard however. By rebuilding it would also help avoid the issue of having to futz with the V-100 file which IIRC shouldn't be touched.


----------



## Macified (Sep 18, 2003)

I have issues with spotlight on the finder as well as mail searches. I can have a window open in front of me with a specific file in it, type the file name into spotlight and spotlight will give me nothing or a list of other potentials but not the file I want.

In mail, I type in an email address (knowing that I received a particular email) and find won't show it. I can scroll down through my mail and retrieve it manually.

Apple needs to fix these search issues.

BTW - I don't diddle with stuff on my work machine. No hacks or tweaks. I don't touch the terminal.


----------



## MacDoc (Nov 3, 2001)

This is ongoing in the Apple discussions
Apple - Support - Discussions - Re: Leopard's Spotlight doesn't search ...



> Re: Leopard's Spotlight doesn't search Mail messages
> Posted: Mar 31, 2008 6:31 PM in response to: MikeW
> 
> What does apple have to say about this? Ever since spotlight was introduced, I can NEVER trust my mail searches. I NEVER find what I KNOW IS THERE!
> ...


My reply was this

This was a very gnarly problem for me ( 14 gigs of mail ) and bottom line it's not really Apple's fault.
It's a legacy problem.

*The ONLY solution that has been reliable and complete is to install a fresh Leopard, bring it up to date then use migration assistant to pull from the previous system* that would not search properly.

Let Spotlight do it's new indexing and you should have no further problems. Leopard has a new mail structure which makes it much faster but often causes issues when it's been upgraded. The import gets rid of that by replacing the structural issues and just pulling in the individual mail files and leaving the flawed structure behind.

Rebuilding mailboxes, not letting message load per mailbox go above 5,000 per and running something like Onyx regularly also are important.

One undiscussed aspect is drive optimization which has an impact on large mail file structures. iDefrag does an excellent job.
While X does a decent job of avoiding fragmentation of individual files it does nothing to keep critical file structures closely grouped ( optimized for access ).

•••

I note David Miller took a similar approach with a fresh start and no further problems.



> Re: Leopard's Spotlight doesn't search Mail messages
> Posted: Apr 8, 2008 11:14 PM
> 
> Just wanted to give my 2 cents. I had this problem too with my IMAP email. After lots of investigation I narrowed the problem down to one thing. .imapmbox folders. The content was actually indexed. It just would not show any results from a folder that had .imapmbox as a folder extension name. as soon as a renamed the folder to something else spotlight would show me results from within. I never figured out what was causing spotlight to do this. I wound up reformatting my drive and starting from scratch. No problems since the clean setup for about two weeks now.


And to answer the obvious archive and install does not solve the problem. Clean install and migrate does appear to.
I have had no issues since I posted this.


----------



## EvanPitts (Mar 9, 2007)

No wonder why I dislike Spotlight, and now I can add another reason...

I sure hope there is an actual solution, since this is supposed to be a feature. Did they borrow it from the Evil Empire? beejacon


----------



## Pelao (Oct 2, 2003)

MacDoc

Thanks for the update. I like Spotlight and have never had any issues with it. I work with thousands of docs, images and e-mails and it has saved many hours of searching. his latest information may help explain why I have never had issues with Spotlight and Mail - I ran a clean instal when moving to Leopard, and migrated stuff across.

FWIW I have tried the other search tools out there, and for my particular uses they offer no advantages, though I understand why some worship them.


----------



## MannyP Design (Jun 8, 2000)

MacDoc said:


> Take a hike your pontification is doltish and typical for you. Some people have a problem with this period if you have nothing cogent to add to its solution then get lost. Your juvenile sulleness is wearisome.


I realize there's a history between you and PB, but you're WAY out of line, chum. Totally uncalled for.


----------



## (( p g )) (Aug 17, 2002)

MannyP Design said:


> I realize there's a history between you and PB, but you're WAY out of line, chum. Totally uncalled for.


I agree.


----------

