Ios Firebase Swift:查询多个值

Ios Firebase Swift:查询多个值,ios,swift,firebase,firebase-realtime-database,uisearchbar,Ios,Swift,Firebase,Firebase Realtime Database,Uisearchbar,我正在从事一个使用Firebase作为后端的项目。在应用程序中,您可以使用搜索栏搜索爱好,该搜索栏应始终返回在其个人资料中有此爱好的用户。但它一次只对一个值有效 我的Firebase的结构如下:.indexOn:“name”: 这是我在UISearchBartextdichange方法中的代码: let mainRef = FIRDatabase.database().reference().child("hobbies") mainRef.queryOrdered(byChild: "name

我正在从事一个使用Firebase作为后端的项目。在应用程序中,您可以使用
搜索栏
搜索爱好,该搜索栏应始终返回在其个人资料中有此爱好的用户。但它一次只对一个值有效

我的Firebase的结构如下:
.indexOn:“name”

这是我在
UISearchBar
textdichange
方法中的代码:

let mainRef = FIRDatabase.database().reference().child("hobbies")
mainRef.queryOrdered(byChild: "name").queryStarting(atValue: searchText).queryEnding(atValue: searchText).observe(.childAdded, with: { (snapshot) in
有了这个,我已经能够找到一个单词,但我不知道如何或者是否有可能一次搜索多个单词

这里有一个小例子:

当我查找足球时,我想显示所有喜欢足球的用户。如果我将
basketball
添加到它中,我希望结果能够过滤出人们对这两个项目的喜爱程度

听起来很简单,但我还是个初学者,非常感谢你的帮助!谢谢

let mainRef = FIRDatabase.database().reference().child("hobbies")
mainRef.queryOrdered(byChild: "name").queryStarting(atValue: searchText).queryEnding(atValue: searchText).observe(.childAdded, with: { (snapshot) in