V2: Add new query `SortByNatural`
See original GitHub issueIs your feature request related to a problem? Please describe
Currently (even in V1), we can only fetch and sort using normal SortBy
, but it sorts files like this… 1-name, 10-name, 2-name, 3-name, etc.
Describe the solution you’d like
- To be able to sort the files naturally like this… 1-name, 2-name, 3-name, 10-name
- So, in addition to the
SortBy
option, kindly add one more option ofSortByNatural
usingIntl.collator
https://github.com/nuxt/content/blob/1968257881db58634bdf4448bd85d7b059f88e4c/src/runtime/query/query.ts#L35
This way we can directly naturally sort while fetching itself and then properly use limit
, etc. options.
Describe alternatives you’ve considered
Fetch thousands of posts without any sort, and then use Intl.collator
to sort them, and then filter out only first n posts. But it’s not performant if there are so many posts.
Additional context
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Working with query editor v2 - Amazon Redshift
The query editor v2 opens in a new browser tab. The query editor page has a navigator menu where you choose a view...
Read more >Append queries (Power Query) - Microsoft Support
In Power Query, the Append operation creates a new query that contains all rows from a first query followed by all rows from...
Read more >How to use Microsoft Power Query - YouTube
Power Query is the easiest way to connect, extract, transform and load ... Excel 13:34 Insert pivot table & chart 14:46 Importing additional...
Read more >QMF V11.2 - Creating analytical queries - IBM
Conditional Grouping Query - With Conditional Grouping queries you can create aggregated summaries of result set data based on conditional expressions. Column ...
Read more >Join two or more tables in Excel with Power Query - Ablebits
Among other things, Power Query can join 2 tables into 1 or combine data from multiple tables by matching data in columns, ...
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
Seems like a good solution to order by default, what do you think @farnabaz ?
Instead of having
sortByNatural
I’m proposing a change insortBy
and create mongo like sorting util which is more powerful and fix multiple issues in sorting, like case insensitive sorting, or natural sorting.