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

Not Planned Natural Sort?

Discussion in 'Closed Suggestions' started by gordy, Aug 14, 2010.

  1. gordy

    gordy Well-Known Member

    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
    
     
  2. Mike

    Mike XenForo Developer Staff Member

    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.
     
  3. gordy

    gordy Well-Known Member

    Yep, that's what I meant -
    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
    
     
  4. Mike

    Mike XenForo Developer Staff Member

    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.
     
  5. gordy

    gordy Well-Known Member

    I can see that being a problem for threads, where as other items may benefit.
    Caching it statically would still be too much..
     

Share This Page