如何将 firestore 数据推送到 algolia Swift

how to push firestore data to algolia Swift

过去几个小时我一直在研究如何使用 Firestore 在 iOS 应用中进行全文搜索。我最终意识到不支持全文搜索。我阅读了 Algolia,观看了教程,阅读了文章,但仍然没有在 Swift 中看到将数据从 Firestore 推送到 Algolia 的方法。有人可以指导我使用 post 或者添加代码片段之类的东西来告诉我如何使用这个软件吗?谢谢

Algolia 提供 SWIFT API 客户

Swift API client is an open source, production-ready API wrapper that abstracts from the complexity of directly interfacing with the Algolia Search API

基本上要使用任何 API 客户端与 algolia 一起工作,您需要做一些事情,

  1. 安装 algolia 客户端

https://www.algolia.com/doc/api-client/getting-started/install/swift/?client=swift

  1. 使用您的应用程序 ID 和 KEY 初始化客户端

https://www.algolia.com/doc/api-client/getting-started/instantiate-client-index/

  1. 索引您的数据并设置可搜索属性

https://www.algolia.com/doc/api-client/methods/indexing/ https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/

  1. 执行搜索

https://www.algolia.com/doc/api-reference/api-methods/search/

其中有许多子操作可以改善您使用 Algolia 的体验。我建议您完整阅读文档。

  • 是的,几乎没有其他方法可以使用 algolia,比如使用 cloud functions 将数据索引到 algolia 中,并且只从您的客户端进行搜索。但正如您特别提到的那样 SWIFT 以上参考资料将帮助您入门!