ios - 使用未指定的索引。考虑添加 ".indexOn": "phone" at/use_frameworks_beta_2/searchIndex to your security rules for better performance

标签 ios firebase search chat

我有一个 iOS 应用程序,我必须在其中实现两个用户之间的简单聊天。我在应用程序注册期间将用户注册到 Firebase。一切都很好。但是,当我必须启动聊天线程时,我正在使用搜索索引搜索用户,但出现以下错误:

使用未指定的索引。考虑将/use_frameworks_beta_2/searchIndex 中的 ".indexOn": "phone"添加到您的安全规则中以获得更好的性能 使用未指定的索引。考虑将/use_frameworks_beta_2/searchIndex 中的 ".indexOn": "email"添加到您的安全规则中以获得更好的性能 使用未指定的索引。考虑将/use_frameworks_beta_2/searchIndex 中的 ".indexOn": "name"添加到您的安全规则中以获得更好的性能

Firebase控制台规则如下

{ “规则”:{ “.read”:是的, “.write”:是的, “搜索索引”:{ “.indexOn”:[“电子邮件”,“电话”,“姓名”] } }

请帮我解决这个错误。

最佳答案

.indexOn 说明符必须放在规则中包含索引键的位置。更新您的规则以将 .indexOn 放在树中的正确位置:

{
  "rules": {
    ".write": true,
    ".read": true,
    "use_frameworks_beta_2": {
      "searchIndex ": {
        ".indexOn": ["email","phone","name"]
      }
    }
  }
}

关于ios - 使用未指定的索引。考虑添加 ".indexOn": "phone" at/use_frameworks_beta_2/searchIndex to your security rules for better performance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44887552/

相关文章:

ios - '一个 AVPlayerItem 不能与多个 AVPlayer 实例相关联'

swift - 是否可以将文件从 Swift 应用程序发送到 Firebase 中的可调用函数?

javascript - 如何在 firebase 中查询给定键的多个值

vba - 在 VBA 中搜索多个术语的文档?

android - 处理搜索的最佳实践

ios - SFSafariViewController 的问题

ios - 更改 AVCaptureOutput 时如何避免 AVCaptureVideoPreviewLayer 闪烁

ios - 在 UINavigationController 中隐藏导航栏时不向后滑动

javascript - react : Firebase Listener Not Working

sql - SQL 全文搜索中使用通配符 (*) 和单词分组的智能搜索