Applying Word Stemming in SearchView for fetch data from Firebase database

百般思念 提交于 2019-12-17 06:18:17

问题


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.


回答1:


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:

  1. Create a new query based on the new filter:

    Query query = usersRef.orderByChild("name").equalTo(newText);
    
  2. Attach a listener to this new created query.

  3. Create a new adapter with the results of this new created query, or update the existing one using notifydatasetchanged() method.



来源:https://stackoverflow.com/questions/50682046/applying-word-stemming-in-searchview-for-fetch-data-from-firebase-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!