Nicola Chiari
Nicola Chiari

Reputation: 259

Filter with firebase recyclerView

I'm using firebase recyclerview to get a list of users from the server. I would implement a search for other users, I've seen that I can use orderByChild() or equalsTo() to search.

This method works, but I have to write exactly the username I am looking for. You can do more in-depth research, for example by doing a search on a similar non-equal content.

This is a problem when I look for a username and I write a little. if this has the uppercase first I can not find it. I hope someone helps me find a solution. Thank you

mAdapter = new FirebaseRecyclerAdapter<FriendItem, FriendViewHolder>
    (FriendItem.class, R.layout.ranking_item, FriendViewHolder.class,
    mDatabase.child("user-profile").orderByChild("username").equalTo(search_edt.getText().toString())) {

Upvotes: 0

Views: 151

Answers (1)

nagabandaru
nagabandaru

Reputation: 645

Firebase Database API does not support regex or contains('<your-string>') kind of support. You have to get all the data and filter on the client.

Upvotes: 1

Related Questions