Zigmārs Dzērve Zigmārs Dzērve - 22 days ago 22
Android Question

How to do a simple search in string in Firebase database?

I want to create a simple search in my app, but cannot find anything on interwebs about it, that's more recent than 2014. There must be a better way. There are startAt and endAt functions but they don't work as expected and are case sensitive. How do you guys solve this problem? How can this functionality still not exist in 2016?

Answer

Firebase dont have a great SQL like searches built in. You can either sort by values/key or you can equalto

https://firebase.google.com/docs/database/android/retrieve-data

You can find examples at the link above. That is the latest documentation for firebase.

If you are looking for SQL like searches. Then take a look at elastic search. But that will increase the complexity since you need a platform to put it on. For that i could recommend Heroku or maybe GoogleCloudServers

Here is a blog post about advanced searches with elastic search https://firebase.googleblog.com/2014/01/queries-part-2-advanced-searches-with.html