android - Firebase Query an Array of Keywords -
my code
firebasedatabase database = firebasedatabase.getinstance(); databasereference myref = database.getreference("stock"); query = myref.orderbychild("keywords").equalto("hammer"); i.addvalueeventlistener(new valueeventlistener(){ @override public void ondatachange(datasnapshot datasnapshot) { system.out.println(datasnapshot.getvalue()); } @override public void oncancelled(databaseerror databaseerror) { } });
my problem: wanna query 1 item keyword eg. "hammer", getting null value. if query "orderbychild("keyword").equalto("hammer")" i'm getting same null value. please me.
orderbychild
next level childs branch refering in /stocks
. code work if had child keywords/0/keyword
right bellow /stocks
. since under /stocks/inserate/0
wont work.
query = myref.child("inserate/0/keywords").orderbychild("keyword").equalto("hammer");
this trick might not want. if want search in iserates
childs should refactoring database.
Comments
Post a Comment