Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION/SUGGESTION] Alphanumerical natural sorting #2577

Open
Deathnetworks opened this issue Dec 27, 2024 · 1 comment
Open

[QUESTION/SUGGESTION] Alphanumerical natural sorting #2577

Deathnetworks opened this issue Dec 27, 2024 · 1 comment
Labels

Comments

@Deathnetworks
Copy link

Trying to sort text that contains numbers and can't seem to find away that doesn't involve loading the entire db and using C# to do the sorting via a comparer

records = (from x in col
                               .Query()
                               .OrderByDescending(x => x.title)
                               .Skip(pageskip)
                               .Limit(limit ?? 50)
                               .ToEnumerable()

SELECT $ FROM book order by title ASC

Example results I'm getting -

  • "x - Chapter 1"
  • "x - Chapter 10"
  • "x - Chapter 100"
  • "x - Chapter 101"
  • "x - Chapter 102"
  • "x - Chapter 103"

How I'd prefer it be sorted

  • "x - Chapter 1"
  • "x - Chapter 2"
  • "x - Chapter 3"
  • ....4-9
  • "x - Chapter 10"
  • ...11-99
  • "x - Chapter 100"
  • "x - Chapter 101"
  • "x - Chapter 102"

Any suggestions on accomplishing this feat?

Using 5.0.8

@Deathnetworks
Copy link
Author

Yup, that's the solution that requires loading the db then using c# to sort...
Was hoping for a way to do it directly via the db so it's not as heavy/slow.

But that's exactly what I ended up running with, while using filtering to reduce the dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant