【发布时间】:2018-02-06 04:59:56
【问题描述】:
我试图在使用Cloud firestore 作为数据库的Android 应用程序中实现全文搜索,所以在文档中他们说firestore 不支持它并选择Algolia(第三方),最初我尝试使用@ 987654327@ 搜索一些示例数据,效果很好。现在我需要将数据从firestore 同步到 algolia,我只获取实时数据库的文档,而不是云firestore。
Algolia 提供的文档,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