I've the following structure in my firebase:
How can I make a search filtering by title? I know that firebase does not have LIKE operator, but a search by the starting chars would be possible?
I've already searched over StackOverflow and the most common anwers seems to be something like this:
firebase.reference.child("music")
.orderByChild("title")
.startAt("fog")
.endAt("fog" + "\uf8ff")
.addListenerForSingleValueEvent(object : ValueEventListener {
override fun onCancelled(p0: DatabaseError) {}
override fun onDataChange(p0: DataSnapshot) {
Log.i("DATABASE_RETURN", p0.toString())
}
})
That code returns always null, here's what it's printing:
I/DATABASE_RETURN: DataSnapshot { key = music, value = null }