How to avoid duplicate messages in OS X Mail.app with Spotlight (Gmail)
I love Spotlight in OS X, especially for finding that particular message. Finding a message buried in thousands of mails can be as easy as typing into Spotlight some of the properties of the mail you are looking for. If you use IMAP with Gmail, or IMAP with a domain of your own under Google Apps, you might notice that when you search for a mail, lots of duplicates can quickly pile up, which is truly frustrating:

Thanks, but no thanks!
I quickly got fed up with this and decided to look for a solution and fortunately there is one
The first thing you need to do is enable Labs for your Gmail account, this is simple and I found some instructions here.
Once you have enabled Labs, access the Labs tab and look for a lab feature called Advanced IMAP Controls:

Enable this option
Once you have enabled the feature, make sure you scroll down and click the Save Changes button or nothing will be saved.
Almost there…now from your Gmail account, from Settings and then hit the Labels link:

You should now get a listing of the mailboxes that usually show up in Mail. Un-check the one that is causing the duplicates to show up in Spotlight, which is usually the All Mail one. As an extra, I like to uncheck the Spam folder as well, I really don’t go around looking for spam every now and then:

Close and reopen Mail.app, rebuild your Spotlight index and say goodbye to duplicate entries in your Spotlight results forever!
Sources:
http://www.macosxhints.com/article.php?story=200802081934189
