View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0019267 | MMW 5 | DB / Backup | public | 2022-07-21 13:09 | 2022-07-23 07:48 |
Reporter | zvezdan | Assigned To | |||
Priority | none | Severity | minor | Reproducibility | N/A |
Status | feedback | Resolution | open | ||
Summary | 0019267: SQL collation for natural sort order needed | ||||
Description | There was a request by Bex for such thing in MM4 that never happened, not even assigned to anyone (https://www.ventismedia.com/mantis/view.php?id=6253). Some users are asking for numerical sort of custom fields, but natural sort order would be a more general solution which could sort properly any text containing just numbers as well. And it should be configurable to any textual field, not only custom fields, because someone would want to use it for Title or Filename or whatever else. Here is the quote by Bex: "Many users would like MM to sort text fields as windows explorer does. I.e. in natural sort order. Currently MM sorts: Track1.mp3 Track10.mp3 Track2.mp3 While Explorer sorts: Track1.mp3 Track2.mp3 Track10.mp3" Or, this quote from one users that asked such thing for Magic Nodes (https://www.mediamonkey.com/forum/viewtopic.php?p=432533#p432533): "it looks like this: Deep Dance 1 + 2 - Deepest Deep Deep Dance 125.5 Deep Dance 147 Deep Dance 148,5 Deep Dance 3 + 4 - Starship Countdown Deep Dance 5, 6, 7 - The Digital Dances - Compilation I But I want to have this sorting: Deep Dance 1 + 2 - Deepest Deep Deep Dance 3 + 4 - Starship Countdown Deep Dance 5, 6, 7 - The Digital Dances - Compilation I Deep Dance 125.5 Deep Dance 147 Deep Dance 148,5" | ||||
Additional Information | You could read this discussion about natural sort order that involved Richard Hipp, the author of SQLite, who posted the related collating function: https://sqlite.org/forum/info/d5cf6c6317dd7e7f | ||||
Tags | No tags attached. | ||||
Fixed in build | |||||
|
From what I see the requested SQL collation in MM5 is currently called: COLLATE NUMERICSTRING And is used for fields like Songs.DiscNumber, Songs.TrackNumber (other text fields are using COLLATE USERLOCALE) Maybe the 'COLLATE NUMERICSTRING' would make sense for fields like path, filename and maybe the custom fields? But as the sorting in MM5 UI isn't based on SQL sorting then I guess this doesn't help and you are rather asking a new option (in Tools > Options) to override the native MM5 sorting when sorting lists? |
|
BTW: In the code I see that the numeric sorting has been already implemented for custom fileds in course of 0014365 (i.e. in version 5.0.1) |
|
Does your COLLATE NUMERICSTRING resolve the examples that I mentioned? Why don't you use SQL sorting for UI? I am not asking for a new option in Tools > Options, but for a SQL collation that could be used in any SQL query in the add-ons or in your own code. It could be used to sort not only lists, but nodes as well. Or whatever else you decide to sort using SQL. However, if you add such collation, you could also add an option in the Tools > Options for users to choose which sorting order they want for a particular field. And by field I mean any specified field, not only custom fields, because maybe someone could want to get filenames or titles sorted by natural sort order. But in that case your program should respect such option and sort specified fields appropriately in every tracklist in the program that allows sorting by specified fields including the main tracklist. I am not sure that "the numeric sorting has been already implemented for custom fileds" since you are still getting requests in the forum for such thing, and there is even posted a recent issue for it: https://www.ventismedia.com/mantis/view.php?id=19250 But such requests cover only a small part of wanted usage. The numeric sorting of textual fields is just a special case of natural sort order. As I said in description, the natural sort order could be applied to the custom fields containing only numerical values as well. |
|
To answer my own question. No, the COLLATE NUMERICSTRING doesn't sort using natural sort order. The both examples that I mentioned returns the usual alphanumeric order when using NUMERICSTRING collation. However, it returns A1, A10, A2 correctly as A1, A2, A10. I mean "correctly" for natural sort order. |