Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Case insensitive sorting with Firebase orderByChild

I’m using a FirebaseRecyclerAdapter to display a list of strings. My query uses orderByChild. The results sorts with capitalize letters first and looks like this:

Item 1, Item 2, Item 3, aItem, bItem, zItem.

How do I use orderByChild resulting in case insensitive sorting?

like image 939
Loren Avatar asked Jun 05 '16 15:06

Loren


1 Answers

You don't. Kind of.

If you have data you want to sort by but there also needs to be a user representation of that data, keep two versions

posts
  post_id_0
    display_version: William
    sort_version: william
  post_id_1
    display_version: Henry
    sort_version: henry

Of course you could read in all of the data from Firebase and use .toLower or whatever your platform call is and then sort in code.

like image 66
Jay Avatar answered Sep 29 '22 15:09

Jay