I am developing an Android application using Firebase as a backend. I am new to Firebase and am stuck in the problem, but the problem is that when I try to search for a record using the startAt query startAt it returns results that do not start with the keyword that I entered.
Here is the dataset
itemname -KK8vI8A5BZZp3Xo3FpA name: "abc" -KK8w3uoJdJ0hBSrq0CS name: "test" -KKAC1o9Vazyg9JLtDoQ name: "dude"
And here is the snippit code
Query query = firebase.child(Constants.KEY_ITEM_NAME).orderByChild("name").startAt("abc"); query.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Iterator<DataSnapshot> i = dataSnapshot.getChildren().iterator(); while (i.hasNext()) { DataSnapshot d = i.next(); LOG(d.getKey(), d.getValue().toString()); } }
So when I look for abc , the answer also includes test . Maybe I'm doing something wrong, or I'm wrong. Can someone point me in the right direction.
PS I'm trying to use AutocompleteTextView to search for items.
thanks
source share