MySQL、MongoDB 和 Solr

发布于 2025-01-02 20:00:07 字数 425 浏览 1 评论 0原文

我对 NoSQL 数据库不太熟悉,也不太了解它们的潜力,而且我还在学习中。同时,我需要开发具有搜索功能的简单应用程序。

我读过一些关于 Solr、MongoDB 以及它们的组合的文章。但是,我必须创建的应用程序应该包含许多“标准”内容(例如组合框,应该从数据库填充)。此外,还有元数据和其他附加信息的字段。

我想到的想法是开发 MySQL 数据库来保存关系数据(如元数据、组合框值、注释...)。对于每条记录,我可以生成应转发到 Solr 的 ID,以及应建立索引的文档。 Solr 将进行索引,并且具有指定 ID 的文档可以存储在 MongoDB 中。

可能有一种更简单的方法,我想听听:)这并不难,但我不确定这是最好的方法。最终,应用程序应该相当简单:用户应该选择几个预定义字段,输入更多字段并上传文档(或其中几个)。如果有人可以建议更好的架构,我将不胜感激。

最好的

I'm not so familiar with NoSQL databases, and I'm not quite aware of their potential, and I'm still learning. In meantime, I need to develop simple application with search capabilities.

I've read a few posts about Solr, MongoDB and combination of these. But, the application I have to create, should include many "standard" things (like Combo boxes, which should be populated from database). Also, there are fields for metadata, and other additional info.

The idea I thought about is to develop MySQL database which will keep relational data (like metadata, combobox values, notes...). For every record, I could generate ID which should be forwarded to Solr, together with document which should be indexed. Solr will do indexing, and that document, with assigned ID could be stored in MongoDB.

Probably there is an easier way, and I would like to hear that :) this is not that hard, but I'm not sure that is the best way. At the end of the day, application should be fairly simple: user should choose few predefined fields, enter few more fields and upload a document (or few of them). If someone could suggest better architecture, please, I would appreciate an advice.

Best

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ι不睡觉的鱼゛ 2025-01-09 20:00:07

我将从文档结构开始。

但是,我必须创建的应用程序应该包含许多“标准”
的东西(比如组合框,应该从数据库填充)。
此外,还有元数据字段和其他附加信息。

我听起来 mongodb 非常适合您想要存储的数据,因为您可以将所有与组合框数据相关的内容保留在 mongodb 上的单个文档中,这将非常自然。在 mysql 中,对于所有引用的内容(例如注释、值),您可能会使用单独的表。

这是 mongodb 中潜在模式的示例:

{
 _id : 1,
 name : "andrew",
  values: [
       {_id: 1,
       name: "test 1"},
       {_id: 2,
       name: "test 2"},
   ],
  metadata: {
    storeDate: someDate, 
    anyOtherMetadata: ""
  },
  notes: [
    {_id: 1, "note 1"},
    {_id: 2, "note 2"},
  ]
}

如果您的应用程序应该具有全文搜索,您可以在每次更新/插入时存储信息两次。第一个在 mongodb 中,第二个在 solr 中。同样,您可以拥有需要向最终用户显示的文档(它通常不包含数据库中包含文档的所有信息):

solr 文档:

{
  _id: 1,
  name: "andrew",
  searchField: "here you can store all staff on what you want search"
}

Solr 文档 _id 对应于 mongodb 文档 _id。

所以:

  1. 使用上面的模式,当您需要搜索时,您可以简单地从 solr 填充数据
  2. ,但是当您需要显示特定文档的详细信息时,您可以通过 solr _id 从 mongodb 加载它。

一般来说,我在你的应用程序中没有看到 mongodb、mysql 和 solr 在一起。

我只看到两个合理的组合:

  1. mongodb + solr
  2. mysql + solr

I'll start from document structure.

But, the application I have to create, should include many "standard"
things (like Combo boxes, which should be populated from database).
Also, there are fields for metadata, and other additional info.

I sounds like mongodb very good fit for data you want to store, because you can keep all related to combobox data within single document on mongodb and it will be very naturally. In mysql for all referenced things like notes, values you will probably use separate tables.

This is an example of potential schema in mongodb:

{
 _id : 1,
 name : "andrew",
  values: [
       {_id: 1,
       name: "test 1"},
       {_id: 2,
       name: "test 2"},
   ],
  metadata: {
    storeDate: someDate, 
    anyOtherMetadata: ""
  },
  notes: [
    {_id: 1, "note 1"},
    {_id: 2, "note 2"},
  ]
}

If your app should have full text search you can store information twice on each update/insert. First in mongodb and second in solr. Also in sort you can have document that you need to display to the end user (it usually not contains all information that contains document in a database):

solr document:

{
  _id: 1,
  name: "andrew",
  searchField: "here you can store all staff on what you want search"
}

Solr document _id correspondent to mongodb document _id.

So:

  1. With above schema when you need search you simple populate data from solr
  2. But when you need show details of particular document you load it from mongodb by solr _id.

And in general i don't see in your application place for mongodb, mysql and solr together.

I see only two reasonable combinations:

  1. mongodb + solr
  2. mysql + solr
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文