android - How can I query firebase database with text search -
in android app making have implemented search bar user may type in in hopes of finding in database. have set result come up, if spelled , completely. make can bring results user typing, , if spelled incorrectly , similar. have read possible built in query options firebase library, don't seem support looking for. there way relatively add project? understand predictive text searches not created, there library can import?
building off of martin's answer, if want show if off little filter.
databasereference.orderbychild('_searchlastname') .startat(querytext) .limittofirst(10) //return 10 results ...
i assume can convert list of strings, give of results starting your query , next 9 more want.
from here, want filter based on either contains or startswith
public list<string> filter(list<string> listtofilter, string query){ list<string> results = new arraylist(); for( string string : listtofilter){ if(string.startswith(query){//or contains results.add(string); } } return results }
Comments
Post a Comment