on fixing Spotlight issues with mail.app (and others for that matter)
So, after a while of using Mail.App, the spotlight searches seemed to start taking longer and longer. Even worse, they started not showing the results for stuff that I knew was in there. A little google, and some man and I found “mdimport”. This utility helps you manage and re-import the metadata databases in Spotlight. Here’s what I did:
pal:~ juan$ mdimport -L 2006-05-17 15:59:19.900 mdimport[8546] Paths: id(501) ( "/System/Library/Spotlight/Image.mdimporter", "/System/Library/Spotlight/Audio.mdimporter", "/System/Library/Spotlight/Font.mdimporter", "/System/Library/Spotlight/PS.mdimporter", "/Library/Spotlight/Microsoft Entourage.mdimporter", "/Library/Spotlight/Microsoft Office.mdimporter", "/System/Library/Spotlight/iPhoto.mdimporter", "/System/Library/Spotlight/RichText.mdimporter", "/System/Library/Spotlight/QuickTime.mdimporter", "/System/Library/Spotlight/Mail.mdimporter", "/Library/Spotlight/AppleWorks.mdimporter", "/Library/Spotlight/Keynote.mdimporter", "/Library/Spotlight/SourceCode.mdimporter", "/System/Library/Spotlight/QuartzComposer.mdimporter", "/System/Library/Spotlight/vCard.mdimporter", "/System/Library/Spotlight/Application.mdimporter", "/Library/Spotlight/iWeb.mdimporter", "/Library/Spotlight/Pages.mdimporter", "/System/Library/Spotlight/PDF.mdimporter", "/System/Library/Spotlight/Bookmarks.mdimporter", "/System/Library/Spotlight/Chat.mdimporter", "/Library/Spotlight/iMovie.mdimporter", "/System/Library/Spotlight/SystemPrefs.mdimporter", "/System/Library/Spotlight/iCal.mdimporter" ) pal:~ juan$
This shows you all of the installed importers. You can then tell mdimport to re-import any or all of these via. For example, to re-import my mail, I did:
pal:~ juan$ mdimport -r /System/Library/Spotlight/Mail.mdimporter
This took a long time (a few hours), but after that, I had a clean, fresh, fast, and accurate spotlight on my mail.
Recently went through a similar journey that wound up at a slightly different endpoint. Spotlight appeared to questionably meta-data’d across the board.
trogdor-5:/usr/bin rshangle$ man mdutil
trogdor-5:/usr/bin rshangle$ df -k
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/disk0s3 292905072 226657840 65991232 77% /
devfs 115 115 0 100% /dev
fdesc 1 1 0 100% /dev
512 512 0 100% /.vol
/dev/disk1s3 292926240 234826080 58100160 80% /Volumes/Backup0000-0000 1
automount -nsl [194] 0 0 0 100% /Network
automount -fstab [202] 0 0 0 100% /automount/Servers
automount -static [202] 0 0 0 100% /automount/static
/dev/disk2s10 159940248 120330652 39609596 75% /Volumes/dcf0000-0007
/dev/disk3s6 488353088 348079128 140273960 71% /Volumes/Backup0000-0001
/dev/disk4s6 490193424 483202544 6990880 99% /Volumes/Mobile DCF 1
/dev/disk5s2 1162664 857388 305276 74% /Volumes/iDisk 1
http://idisk.mac.com/rshangle/ 2147483647 0 2147483647 0% /Volumes/rshangle
trogdor-5:/usr/bin rshangle$ mdutil -E /Volumes/Backup0000-0001
Yeah… the end of that previous comment, which didn’t quite make it, should have indicated that:
mdutil -E /Volume/name
… will blow away all Spotlight metadata for the volume named name… it gets rebuilt automatically later.
r