Applying Word Stemming in SearchView for fetch data from Firebase database
I need to fetch list of users from Firebase database using SeachView
or search dialog and I think word stemming will be best for my app.
Not asking for code but please tell me the alorigthm for it.
To achieve what you want, you need to execute a query which should look like this:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference usersRef = rootRef.child("users");
Query query = usersRef.orderByChild("name").equalTo(newText);
So everytime you create a search you should return a new query. So according to this, every time you want to filter on a new condition, you will need to:
-
Create a new query based on the new filter:
Query query = usersRef.orderByChild("name").equalTo(newText);
Attach a listener to this new created query.
Create a new adapter with the results of this new created query, or update the existing one using
notifydatasetchanged()
method.