I’ve recently pointed out how Spotlight search can miss files whose metadata don’t seem to get incorporated into its indexes properly. It’s a worrying problem, because unless you know what you should find, it’s very hard to see that search results are incomplete.
One solution to this problem is to change the metadata that Spotlight has to rely on. In many cases, it’s recovering these from metadata which are stored within the document data, or the contents of the document itself. In my experience and testing, the metadata which Spotlight is most likely to find are those attached to files as extended attributes (xattrs).
Several types of xattr are specifically intended to contain a document’s metadata, including
- com.apple.metadata:kMDItemHeadline, intended for the document headline;
- com.apple.metadata:kMDItemDescription, for the document description;
- com.apple.metadata:kMDItemCreator, for the name of the document creator, usually its author;
- com.apple.metadata:kMDItemCopyright, for the copyright notice;
- com.apple.metadata:kMDItemKeywords, for a list of keywords.
The Finder may show some or all of those in its Get Info dialog, and miraculously those xattrs are preserved even when the document is shared through iCloud Drive.
The difficulty in using them is that macOS doesn’t provide any app which can create, edit or display these xattrs – even though they’re discovered by Spotlight searches. You can work with them using my free xattr utility xattred, but that’s a general-purpose editor and overkill when you just want to create and edit those xattrs.
I have two apps which are designed to do just what you want. SearchKey sets and changes those specific xattrs on individual files and whole folders.
For example, it’s quick and simple to add author and copyright data to all the images stored in a folder, or to strip them when you want to work on a batch.
If you just want to edit those metadata on individual files, then SearchKeyLite is all you need.
Using xattrs like this has significant advantages over changing any metadata which might be stored inside the document’s data. As well as being more likely to be included in Spotlight searches, adding metadata in xattrs leaves the data in the document completely untouched. They will be stripped, though, if the file is copied to a file system which doesn’t preserve the contents of attached xattrs.
I have just updated both SearchKey and SearchKeyLite to version 1.3, which are now fully compatible with Catalina, as well as working fully in macOS from El Capitan to Mojave. These new versions also check their code integrity when they’re opened, include links to their Product Page, and have minor improvements such as saving their window positions and sizes.
SearchKey 1.3 is now available from here: searchkey13
SearchKeyLite 1.3 is now available from here: searchkeylite13
and both are available from Downloads above, and from their Product Page.