10.4: Unleash Spotlight through Other and Raw queries

May 11, '05 09:24:00AM

Contributed by: Anonymous

Tiger only hintI haven't really read about anyone using the "Other..." option in the query field of a Finder Search. In Finder, open up a window and type Command-F to get the search. Then pop-up one of the query buttons with "Kind", etc, and choose "Other..." at the bottom. There are dozens of kinds of query types, and you can add favorite ones to the main menu. An interesting one is "Raw Query," which lets you type in mdfind-style command-line queries!

If you select a favorite file and in the Terminal do mdls filename, where you replace filename with the name of the file you're interested in, you can see the attribute types that MacOS tracks. Looking at a Quicktime movie, for instance, I see 30 attributes that are currently maintained automatically for us. These include the name, the codec used ("Motion JPEG A"), when the file was created, when it was last accessed, when it was last modified, when its attributes (as opposed to content) were last modified, its kind ("Quicktime Movie"), its media type (Video), its pixel height and width, its bitrate, and much more. (You can add your own metadata in several ways, including using Get Info's Spotlight Comment field.)

For example, to find all movies that are nine seconds or longer, use this raw query:

 mMDItemDurationSeconds >= 9.0
As you can see, this is very powerful...

[robg adds: I realize many of the Spotlight query hints I've run are somewhat similar, have overlapping content, etc. But for now, since it's both so new and so powerful, I feel it's best to get as many tips out there as I can that have at least some amount of unique content. Apologies in advance if I mess up and publish a true duplicate or two!]

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050503002453669