Search, sort using custom file attributes [message #1812] |
Sat, 22 June 2024 06:30 |
DR
Messages: 6 Registered: July 2020
|
Junior Member |
|
|
Hello FTSearch team,
I am searching a large collection of scientific paper PDFs.
I want to sort the found papers by publication year in FTSearch (file creation date etc is irrelevant).
OK, so FTSearch doesn't know any of the document's bibliographic information - although it really ought to.
Let's say I create a custom set of xattrs for each file, with whatever info I need.
Will I be able to search and sort in FTSearch based on these custom xattr names / values?
Thanks.
|
|
|
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
|
|
|