简体   繁体   English

Algolia用于node.js和Mongodb

[英]Algolia for node.js and Mongodb

I have a problem right now, Algolia does provide a rich documentation regarding node.js but my problem right now are 我现在有一个问题,Algolia确实提供了有关node.js的丰富文档,但我现在的问题是

1) how do i import mongodb database to algolia server? 1)如何将mongodb数据库导入algolia服务器? seems like they are showing how to use MySql database instead of Mongodb with node.js 看起来他们正在展示如何使用MySql数据库而不是Mongodb与node.js

2) Im using ejs to render the html, so do i need to query the value of a search using node.js or just let the clientside html handle it? 2)我使用ejs来渲染html,所以我需要使用node.js查询搜索的值,还是让clientide html处理它?

because with ejs I have to use 因为我必须使用ejs

app.get("/testingSearch", function(req, res) {

  res.render('testing', { message: value});
})

app.post("/postSearch", function(req, res) {
  // some searching 
  var name = req.body.name;
  // algolia
});

Anyone who has an experience with algolia + node.js + mongodb , please lend me your advise. 任何有algolia + node.js + mongodb经验的人,请给我你的建议。 Thank you 谢谢

MongoDB MongoDB的

If you just want to have a complete replica of a collection, you can use the Algolia's MongoDB connector . 如果您只想拥有一个完整的集合副本,可以使用Algolia的MongoDB连接器

However, if you want to do a more advanced indexing, you should add algolia indexing calls alongside the calls to your database. 但是,如果要进行更高级的索引,则应在调用数据库的同时添加algolia索引调用。

Rendering 渲染

Algolia has been designed to be used in your front-end. Algolia旨在用于您的前端。 See this FAQ entry . 请参阅此FAQ条目 However, for SEO purposes, a back-end search might make sense to you. 但是,出于搜索引擎优化的目的,后端搜索可能对您有意义。 Since the JS client is isomorphic, you can mix the two pretty easily. 由于JS客户端是同构的,因此您可以很容易地将它们混合在一起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM