Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Fix message counts and 'ghosts' in Mail's smart mailboxes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fix message counts and 'ghosts' in Mail's smart mailboxes
Authored by: smorr on Aug 29, '05 12:58:36PM

Some background info.

Having worked around alot with Mail plugins and indexing information, I have acquired what I think a good understanding of Mail's internal structures. Mail uses a combination of an internal sqlite3 database (envelope index) and spotlighting technology. Spotlight would be prohibitively slow for most searches and mailbox listings so it stores the sender, date, subject etc in the sqlite database (so the table list view is fast and most searches are fast -- compare a search on full text vs a search on subject and you will see what I mean) For smart mailboxes that search both full text and headers, it uses a combination, searching the spotlight index and then searching the results agains the sqlite database -- in fact there is an issue in Mail (up to 10.4.2 at least) where it will always perform this as AND (all criteria must match) ignoring the OR (any criteria may match)

However, it also uses spotlight for full text searches and indexes the other information (sender, date, subject etc) with spotlight as well so that the system wide spotlight search works well. To do the spotlight indexing Mail 2.0 had to go with 1 message=1 file approach (because spotlight indexes files, not records in other databases) but the happy thing about this means that most information is stored redundantly (in the sqlite database), in the emlx file (as a xml plist at the end of the file) and in the spotlight database.

Btw, MailTags extends the information in the emlx file and spotlight, but not the sqlite database to do its magic, so MailTags searches are similar to Spotlight searches.

[ Reply to This | # ]

Fix message counts and 'ghosts' in Mail's smart mailboxes
Authored by: moritzh on Aug 30, '05 01:46:35PM

Good summary of how things work with Mail.app and Spotlight. Your explanations match well with what I experienced.

For smart mailboxes that search both full text and headers, it uses a combination, searching the spotlight index and then searching the results agains the sqlite database -- in fact there is an issue in Mail (up to 10.4.2 at least) where it will always perform this as AND (all criteria must match) ignoring the OR (any criteria may match)

Thanks especially for explaining that, this is one of the things I referred to in the hint when I said that smart mailboxes/Spotlight in Mail.app in many configurations just seemed to buggy/unreliable from my experience to depend on.



[ Reply to This | # ]