将 mongodb 与 solr 集成的动机是什么 [英] What would be the motivation to integrate mongodb with solr

查看:14
本文介绍了将 mongodb 与 solr 集成的动机是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mongodb 是一个 nosql 数据库,任何查询都可以在上面运行,除了全文搜索,因为它会降低整体性能.Solr 是一个搜索引擎.当我们将这两者集成在一起时,我们在两个系统中是否拥有相同的数据?因此,如果我们已经要存储数据,为什么我们不直接将其存储在 solr 和 lucene 中.顺便说一句,我不确定 solr 何时仅存储索引或与数据一起存储.

Mongodb is a nosql db and any query can be run on it except full text search since it reduces the overall performance. Solr is a search engine to search. When we integrate these two together then dont we have the same data in both systems? So if we already going to store the data anyway why we dont store it directly in solr and lucene. Btw i am not sure when if solr stores only index or together with data.

推荐答案

现在我知道原因了,因为只有我们在 Solr 中配置的字段将存储在 lucene 中,我们不会将整个数据也存储在 lucene 中.我们只将搜索条件字段存储在 lucene 中.他们更像是彼此完成.举例说明,假设我有一个包含 40 个字段的文档,其中 5 个是另一个文档.想象一下,我想做一个查询,说我希望文档中的 3 个特定字段等于某个值,并且在父表的一个子文档中,我有另一个条件,特定字段在一个区间内,另一个条件是包括某些词.为此,我可以通过正确配置 solr 仅将这些字段存储在 solr 中,而不是在 mongodb 中拥有额外的索引.

ok now i know the reason since only the fields we have configured in Solr will be stored in lucene we are not storing the whole data in lucene also. We only store the the search criteria fields in lucene. They are more like completing each other. To explain with an example lets say i have a document having 40 fields and 5 of them are another documents. Imagine I want to make a query saying that i want 3 specific field in document to be equal to a certain value and in one of the child document of parent table i have another criteria for a specific field to be in an interval and 1 another to include certain word. For that rather then having extra indexes in mongodb, I can store only these fields in solr by configuring solr properly.

这篇关于将 mongodb 与 solr 集成的动机是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆