• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not planned Natural Sort?

gordy

Well-known member
#1
Will human-readable, natural sort, be available for thread view and other places (pages, etc)?
On some forums where members author tutorials, articles, etc and fail to pad their numbers properly, i.e. 001, 002, etc the sort order breaks (for humans ;) )

Also, it would be nice for the member list as well no? Where the member list would actually start with alphanumeric chars [Aa-Zz,0-9] instead of punctuation ..

ASCII Sort :
Code:
~$ cat sample | sort
cat sort | sort
100    one hundred
101    one hundred and one
111    one hundred and eleven
11     eleven
121    one hundred and twenty one
1      one
2      two
3      three
4      four
5      five
Natural Sort:
Code:
~$ cat sample | sort -V
1      one
2      two
3      three
4      four
5      five
11     eleven
100    one hundred
101    one hundred and one
111    one hundred and eleven
121    one hundred and twenty one
 

Mike

XenForo developer
Staff member
#2
I'm not sure if by thread view, you meant "forum view" (forumdisplay). There's no string-based sorting on threads.

But regardless, you're basically limited to whatever MySQL will give you, which has a lot of language-specific collations, but I don't think anything that supports natural sorting.
 

gordy

Well-known member
#3
I'm not sure if by thread view, you meant "forum view" (forumdisplay). There's no string-based sorting on threads.
Yep, that's what I meant -
But regardless, you're basically limited to whatever MySQL will give you, which has a lot of language-specific collations, but I don't think anything that supports natural sorting.
Ah.. but could it be ``post-processed'' [sic] via php (http://php.net/manual/en/function.natsort.php)?

Notably for articles, or picture albums this would be handy:
ASCII Sorting
Code:
~$ cat sample 
picture1.jpg
picturea.jpg
picturez.jpg
picture4.jpg
picture11.jpg
picture2.jpg
Natural Sorting
Code:
~$ cat sample | sort -V
picture1.jpg
picture2.jpg
picture4.jpg
picture11.jpg
picturea.jpg
picturez.jpg
 

Mike

XenForo developer
Staff member
#4
The only way to do post processing would be to retrieve every thread in the list and sort it in PHP. Not really an option with 1000s of threads.
 

gordy

Well-known member
#5
The only way to do post processing would be to retrieve every thread in the list and sort it in PHP. Not really an option with 1000s of threads.
I can see that being a problem for threads, where as other items may benefit.
Caching it statically would still be too much..