sort-by prop Numerical Ordering Issue
See original GitHub issueI am using an ais-refinement-list
and running into an issue where I cannot properly control the sort-by
prop. I am specifying :sort-by="['isRefined:desc', 'name:asc']"
but the results are returning in the following order:
- 1000-2000
- 10001-11000
- 11001-12000
- 12001-15000
- 15001-20000
- 20001-50000
- 2001-3000
- 3001-4000
- 4001-5000
- 5001-6000
It would be helpful to be able to tell Algolia to sort these results like you would sort actual numbers, like this:
- 1000-2000
- 2001-3000
- 3001-4000
- 4001-5000
- 5001-6000
- 10001-11000
- 11001-12000
- 12001-15000
- 15001-20000
- 20001-50000
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Sorting by numerical order - Power Platform Community
I want to display all the teams in numerical order so Team n°1 first ... property to convert TeamNumber to a Number type...
Read more >Sorting and ordering issue lists - GitLab Docs
When you sort by Weight, the issue list changes to sort ascending by the issue weight. Issues with lowest weight are first, and...
Read more >Sorting an array of objects by property values - Stack Overflow
One issue I have with this is that with reverse=false, it will sort numbers as 1,2,3,4... but Strings as z,y,x... – Abby. Apr...
Read more >SortBy - Wolfram Language Documentation
sorts the elements of list in the order defined by applying f to each of them. breaks ties by successively using the values...
Read more >Help:Sorting - Wikipedia
This page is about sorting of tables. For sorting of categories, see Wikipedia:Categorization § Sort keys. For sorting of article sections, see WP:ORDER....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks.
For anyone faced with a similar issue, this is how we fixed it.
First, added a sort method:
Then referenced this sort method:
That’s what I meant, thanks for sharing your solution!