Skip to content

FirebaseRecyclerAdapter view filter #135

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

Closed
sivai2i opened this issue May 23, 2016 · 12 comments
Closed

FirebaseRecyclerAdapter view filter #135

sivai2i opened this issue May 23, 2016 · 12 comments

Comments

@sivai2i
Copy link

sivai2i commented May 23, 2016

I need to filter the data in client side from FirebaseRecyclerAdapter. Is there any way to do it without removing the data in firebase database?

@puf puf added the duplicate label May 23, 2016
@puf
Copy link
Contributor

puf commented May 23, 2016

At the moment, server-side filtering is your best option. We're considering adding client-side filtering (#15), but it's not a very natural fit with the realtime nature of the Firebase Database.

@puf puf closed this as completed May 23, 2016
@sivai2i
Copy link
Author

sivai2i commented May 23, 2016

Then is there any options to filter not equal to any specific value in query.?

@puf
Copy link
Contributor

puf commented May 23, 2016

The query model of the Firebase Database does not support a "not equal"
filter.

But performing such a filter client-side would in that case also not be a
good solution, since you'd be pulling down more data than needed.

A better option would be to model your data in a way that allows this query
For example if you put all the items that have the "not equal" condition
under a common node, you won't need a query at all. This sort of custom
indexing is quite common with Firebase and NoSQL databases in general.

On Mon, May 23, 2016 at 6:28 AM sivai2i [email protected] wrote:

Then is there any options to filter not equal to any specific value in
query.?


You are receiving this because you modified the open/close state.

Reply to this email directly or view it on GitHub
#135 (comment)

@sivai2i
Copy link
Author

sivai2i commented May 23, 2016

But I couldn't have a model like that. Let me tell the scenario which i am facing now. I am developing a chat application where i need to show the list of registered users. All users are under the same node "user". I am fetching all the users from this node so, I need to filter current user from the list of users.

@ghost
Copy link

ghost commented Feb 24, 2017

Exact same issue that I'm facing. Can anyone help us on this one?

@sivai2i , A temporary solution for this would be to let the FirebaseRecyclerViewAdapter work the way it works, but in your ViewHolder, you just show the current user as the current user("You") and disable the click event or any other action in general to the RecyclerView, for that item.

@akashicMarga
Copy link

same problem here

@magdini
Copy link

magdini commented May 7, 2017

I have same problem too. I want to show a list of users except the current user

@eth0izzle
Copy link

eth0izzle commented Jul 10, 2017

In your populateViewHolder() call do something like:

if (user.id.equalsIgnoreCase(application.getUser().id))
    return;

userViewHolder.bind() // etc

and override getItemCount() to return count - 1 (you want to handle instances where count will be 0, etc).

@tango4567
Copy link

device

@samtstern
Copy link
Contributor

@sivai2i are you maybe using INVISIBLE when you should be using GONE to hide views?

@Kishanjvaghela
Copy link

I have created custom FirebaseRecyclerAdapter that support the Filterable feature.
Custom Filterable FirebaseRecyclerAdapter

@Ananthusubramanian
Copy link

Is there any way to stop accessing a particular child from a node using firebase rules? So this problem can be solved easily?

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

No branches or pull requests

9 participants