I have my Gmail set up in OS X Mail as IMAP so that my GMail archive is mapped to the trash folder. This has the nice benefit that deleting messages in Mail is the same as archiving them in Gmail.
However, as my Gmail is set up as IMAP, I have a regular folder labelled "Spam", where 99.9% of my spam nicely goes. But when I search for mail either in Mail's own search or in OS X spotlight, it shows me results that folder too. The only exclusions that seem possible in Mail is to exclude "Junk" (which this isn't), "Trash" or "Encrypted Messages". For Spotlight, I can only exclude certain directories on the operating system.
In summary: Is there a way for me to exclude certain IMAP folders in OS X Mail from being indexed for search and Spotlight?