Select Page
NOTE: This is a static archive of an old blog, no interactions like search or categories are current.

As pointed out in the excellent arstechnica review Apple chose not to expose a fraction of the usefulness of Spotlight to the GUI, I suspect within days there will be a Shareware Spotlight power users GUI out that bridge this gap, I can only wish.
For now, if you want to do some kick arse queries you need to use the command line and it really is very powerful. I scp’d a couple of my photos onto the apple hard drive and now I can do really nice queries over my photos like this one:

[rip@temptation]% mdfind 'kMDItemAcquisitionMake == "nikon*"c && \
kMDItemExposureTimeSeconds >= 1'
/Users/rip/Pictures/book/hms-belfast.jpg
/Users/rip/Pictures/book/london-eye.jpg
/Users/rip/Pictures/book/albert-bridge.jpg

The above bit will find all the photos on my drive shot by a Nikon camera with a exposure time of more than 1 second.
This is pretty kewl, and a wealth of meta data gets stored by default for images, this is a dump of one of the above photos:

[rip@temptation]% mdls /Users/rip/Pictures/book/albert-bridge.jpg
/Users/rip/Pictures/book/albert-bridge.jpg -------------
kMDItemAcquisitionMake         = "NIKON CORPORATION"
kMDItemAcquisitionModel        = "NIKON D70"
kMDItemAperture                = 8.33985
kMDItemAttributeChangeDate     = 2005-04-30 00:54:33 +0100
kMDItemBitsPerSample           = 32
kMDItemColorSpace              = "RGB"
kMDItemContentCreationDate     = 2005-04-24 00:40:51 +0100
kMDItemContentModificationDate = 2005-04-24 00:40:51 +0100
kMDItemContentType             = "public.jpeg"
kMDItemContentTypeTree         = ("public.jpeg", "public.image", \
"public.data","public.item", "public.content")
kMDItemDisplayName             = "albert-bridge.jpg"
kMDItemExposureTimeSeconds     = 5
kMDItemFlashOnOff              = 0
kMDItemFocalLength             = 18
kMDItemFSContentChangeDate     = 2005-04-24 00:40:51 +0100
kMDItemFSCreationDate          = 2005-04-24 00:40:51 +0100
kMDItemFSCreatorCode           = 0
kMDItemFSFinderFlags           = 0
kMDItemFSInvisible             = 0
kMDItemFSLabel                 = 0
kMDItemFSName                  = "albert-bridge.jpg"
kMDItemFSNodeCount             = 0
kMDItemFSOwnerGroupID          = 501
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 1072065
kMDItemFSTypeCode              = 0
kMDItemHasAlphaChannel         = 0
kMDItemID                      = 455102
kMDItemISOSpeed                = -2.321928
kMDItemKind                    = "JPEG Image"
kMDItemLastUsedDate            = 2005-04-24 00:40:51 +0100
kMDItemOrientation             = 0
kMDItemPixelHeight             = 1555
kMDItemPixelWidth              = 2481
kMDItemProfileName             = "sRGB IEC61966-2.1"
kMDItemRedEyeOnOff             = 0
kMDItemResolutionHeightDPI     = 300
kMDItemResolutionWidthDPI      = 300
kMDItemUsedDates               = (2005-04-24 00:40:51 +0100)

All isn’t perfect though, notice the kMDItemISOSpeed? It’s blatantly wrong, so thats really a pain.
Here is a nifty little show off trick with mdfind, the GUI has the nice auto updating of results going which is obviously difficult to show in the command line world, but it has something at least.
To set this up do a query that will match files – one that you can easily add more matches to.

[rip@temptation]% mdfind -live apple
<snip>
Users/rip/Library/Preferences/com.apple.recentitems.plist
/Users/rip/Library/Preferences/com.apple.dashboard.plist
/Users/rip/Library/Preferences/com.apple.Syndication.plist
/Users/rip/Library/Preferences/com.apple.Safari.plist
[Type ctrl-C to exit]
Now here comes the magic, create some files that match in another term or through finder.
[rip@temptation]% mkdir apple
[rip@temptation]% rmdir apple

If you paid attention to the other window you will see it updated on the fly like this:

Query update: 378 matches
Query update: 377 matches

And to see just how deep the indexing goes, if you have Photoshop on your machine, create a new file and put some text on a image, something that will match your query. You will see Spotlight finds even this text on an image.