Closed edemko closed 9 months ago
Hi @edemko
what you describe is clearly a multi-level sorting, two-levels in your example. This is a standard capability of databases and search engines. At the same time it is not implemented in the custom-sort plugin.
I've created a new issue (#86) to assess the complexity of implementation of this new feature. I'm looking in the direction of your example:
target-folder: Journal
> a-z by-metadata: date, < a-z by-metadata: time
Until the feature is available, there is no simple workaround to combine sorting by two metadata fields.
In #86 I also mentioned some simpler less generic options of implementation. The one of numeric by-metadata: -date, time
seems tempting and trivial to implement, isolated and with no big impact. I need to sleep on this idea.
Status update: the multi-level sorting feature has been implemented under #89 - more details in this comment
It will be included in the coming release
The multi-level sorting feature is available in 1.9.0 release of the plugin. More detailed documentation will follow.
For the specific example described in this thread, the final syntax is:
---
target-folder: Journal
> a-z by-metadata: date, < a-z by-metadata: time
---
In other words:
Thank you @edemko - your request was the trigger to build-in the explicit support for multi-level sorting feature
I have tried everything I can find/think of to get this to work, but in lieu of that awful title, lemme give my concrete example:
I've got a folder of journal entries labelled with human-redabnle rough date-times (oh, and some of the times are missing smh):
I'd like to sort these descending by date, but ascending by time/sequence number. I've added
date
andtime
metadata fields (perhaps someday I'll be able to do this from the filename but for now I'm going for easy mode first). Sorting by only one or the other does give the expected results, but when I try to combine them, everything goes wonky.gives
date: 2021-08-28
time: 5
date: 2021-08-24
time: 5
date: 2021-08-24
time: 4
date: 2021-08-28
time: 0.2
date: 2021-08-28
time: 0.1
which looks like descending time, then descending date within those groups. Oddly,
> a-z by-metadata: time, < a-z by-metadata: date
does not change the order. To be fair, I can't really tell what comma is supposed to be doing anyway.gives
date: 2021-08-28
time: 5
date: 2021-08-28
time: 0.2
date: 2021-08-28
time: 0.1
date: 2021-08-24
time: 5
date: 2021-08-24
time: 4
which appears to be doing what I want, except that it's sorting time in the reverse of how I want it. Interestingly, if I swap the time to descending, the order is unchanged, and likewise if I delete the line mentioning time! The syntax reference seems to tell my I'm barking up the wrong tree with this syntax, but I'm not sure.I did try
/!
operators at one point, but it didn't work, and the docs suggest that's not right either.At this point, anything is helpful! I'm not even convinced this capability exists (yet!).