Re: Search, sort using custom file attributes [message #1822 is a reply to message #1812] |
Tue, 16 July 2024 16:09 |
FoxTrot Engineering
Messages: 406 Registered: April 2020
|
Senior Member |
|
|
Yes, you can search custom extended attributes.
These attributes start with the "com.apple.metadata:" prefix. For example, to add a publication year attribute, type the following command in a Terminal.app window (replace ... by the path to your file):
xattr -w com.apple.metadata:publication.year "1970" ...
The content of these attributes are added to the "other metadata" field when updating the index, so you can find it by searching either [content, any metadata or file name], or just [other metadata].
To specifically search a given custom attribute, add a [then filter by Spotlight attribute] criterion, select [other Spotlight attribute…] in the popup menu, click the [Add…] button, and type the extended attribute name (without the "com.apple.metadata:" prefix), as well as a human readable name and description, and click [Add]. Make sure to check the [in menu] checkbox for this attribute, and click [OK]. Then select this attribute in the [then filter by Spotlight attribute] criterion popup menu.
You can't sort the result list by a custom attribute; however when using [then filter by Spotlight attribute], the content of this (Spotlight or extended) attribute should appear in the excerpt column.
Jérôme - FoxTrot Engineering
|
|
|