1
databaseReference.child("List").orderByChild("Country")
.equalTo("US")
.addListenerForSingleValueEvent(new ValueEventListener() {
如果国家值仅为“美国”,则可以正常工作。如何使用firebase(android)搜索regex?
但是,如果国家的价值超过一个字:“美国英国”它不显示此值,在这种情况下如何搜索值“美国”?
感谢您的帮助!
Firebase数据库不支持包含*或*正则表达式的查询。看到我的相关列表回答在这里:https://stackoverflow.com/questions/39606627/firebase-app-search-feature-query-using-string-regex#comment66522784_39606627 –
你想要做的事情看起来像一个分类项目。在这种情况下,通常会帮助创建倒排索引,将每个类别映射到与该类别匹配的项目。看看我的答案在这里:http://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value –