If I open up Spotlight, I can use metadata attributes such as kind:pdf
and date:today
to refine my search.
I'm curious if there's a way to list all of these attributes that I can use with this syntax (attribute:value
)
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityGood question. There is a page on the Apple Developer site that goes into details of Spotlight metadata attributes. Though it's developer focussed I think you'd be able to draw inferences from the attribute keys listed there, e.g.
The nice thing about this list is, that it's quite exhaustive, but it also means that developers would have needed to build this into their apps, so that Spotlight could accurately index the content.
On this list you also find more "obscure" (or lesser known) attributes, such as
If you're interested, there's also an oldish article over at the Superuser blog that gets into some of the details of using Spotlight including commands you can use from Terminal. There's a link in the article (about ⅔ down) pointing to a full list of attributes Spotlight keeps for you. That link is dead, but I've dug out a copy from the Wayback Machine for you. It's similar to the page on the Apple Developer site I provided before.
I've tried some of these examples out and it turns out that the command line would allow you to use the listed attributes, such as kMDItemLastUsedDate
. It also seems to allow for a much finer use, such as Boolean use and number ranges like ">=10".
I've subsequently successfully used TextContent:"something"
, Country:AU
(for Australian content), date>20/1/2017
(that's 20 Jan 2017 in my lingo and filters everything after that date) and author:Alex
(e.g. returns documents and emails created by me) in Spotlight's GUI. This article on Spotlight tips for El Capitan & Yosemite (slide 10) mainly mentions the kind:
filter, though they also name the above date and author.
What you can use very much depends on what developers of applications that save documents to disk have implemented using the metadata importer to provide Spotlight support.
mdimport -A
(command line) lists available attributes.man mdimport
for more info and related commands. – mtklr Oct 8 '17 at 23:39