【问题标题】:Full text Search in firestore using algolia使用 algolia 在 Firestore 中进行全文搜索
【发布时间】:2018-02-06 04:59:56
【问题描述】:

我试图在使用Cloud firestore 作为数据库的Android 应用程序中实现全文搜索,所以在文档中他们说firestore 不支持它并选择Algolia(第三方),最初我尝试使用@ 987654327@ 搜索一些示例数据,效果很好。现在我需要将数据从firestore 同步到 algolia,我只获取实时数据库的文档,而不是云firestoreAlgolia 提供的文档,google 提供的文档, 他们提供了 node.js 功能,并且我是 node.js 的新手。我找不到任何与 firestore 与 algolia 同步相关的教程,所以有人知道从哪里开始吗?我能够使用节点js将数据上传到firestore,我需要将数据从firestore导出到algolia。我使用google给出的node.js进行了尝试。这是我得到的错误。我尝试更改节点版本,但没用。

    path.js:28
    throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'path', 'string');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
    at assertPath (path.js:28:11)
    at Object.join (path.js:1244:7)
    at database (/Users/Desktop/Projects/FirebaseCLI/functions/node_modules/firebase-functions/lib/providers/firestore.js:36)
    at Object.document (/Users/Desktop/Projects/FirebaseCLI/functions/node_modules/firebase-functions/lib/providers/firestore.js:44)
    at Object.<anonymous> (/Users/Desktop/Projects/FirebaseCLI/functions/index.js:27)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

这是我在firestore中为文档提供的文档路径

    firestore exports.noteCreated = functions.firestore
  .document('note/{noteId}')
  .onCreate(event => {
    // Get an object representing the document
    // e.g. {'name': 'Marie', 'age': 66}
    console.log('New Note Created');
});

【问题讨论】:

  • 我认为你应该研究 firebase 函数。这样您就可以监控数据库中的相关节点,并将它们同步到 Algolia。
  • 是的,我尝试使用文档中的函数,但我收到此错误 TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
  • 嗨@Dinesh。你能为这个错误提供一些上下文吗?
  • @DauleDK 嗨,请检查编辑,我已经发布了错误
  • 你在代码的什么地方使用了路径?

标签: android node.js full-text-search google-cloud-firestore algolia


【解决方案1】:

这是由于未设置 GCLOUD_PROJECT 环境变量。我创建了一个pull request 以在此处显示更有用的错误消息。

设置环境变量可以使用cross-env:cross-env GCLOUD_PROJECT=whatever

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-26
    • 1970-01-01
    • 2021-01-15
    • 2020-05-06
    • 2012-07-29
    • 1970-01-01
    • 2023-03-02
    • 2010-11-11
    相关资源
    最近更新 更多