android - Firebase Query an Array of Keywords -


that's firebase structure

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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -