问题描述
Mongodb是一个nosql db,除了全文搜索外,任何查询都可以在其上运行,因为它会降低整体性能. 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个特定字段等于某个值,并且在父表的一个子文档中,我有一个特定条件在区间中的另一个条件,而另一个要在一个标准中包括某些词.为此,而不是在mongodb中具有额外的索引,我可以通过正确配置solr将这些字段仅存储在solr中.
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集成的动机是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!