简体   繁体   English

用SOLR 4.0索引许多表,然后在查询期间将它们联接?

[英]Indexing many tables with SOLR 4.0 and then joining them during the query?

How is it possible to index many tables in SOLR 4.x (or greater), if the tables are not associated to each other? 如果表之间没有关联,如何在SOLR 4.x(或更高版本)中索引许多表?

Or is this approach wrong? 还是这种方法是错误的?

For example if I have tables about 例如,如果我有关于

tableShop
tableProduct
tableBook
tableWhatever

Shop , Product and Book are associated to each other, but tableWhatever is not associated, but I need to index it too. ShopProductBook彼此关联,但是tableWhatever并不关联,但我也需要对其进行索引。

Or maybe some books in tableBook are not assigned to any row of tableShop , how can I index them with SOLR??? 或者也许tableBook中的某些书没有分配给tableShop任何行,如何使用SOLR对其进行索引?

This totally depends on your business model. 这完全取决于您的业务模型。 With the latest versions of solr, you can use the cores to separate documents with different schema. 使用最新版本的solr,您可以使用核心来分离具有不同架构的文档。 But what makes a document usually depends on your view of the Entity and how search happens on that entity. 但是,文档的构成通常取决于您对实体的看法以及在该实体上进行搜索的方式。

In your case, you can model each table to be a document, and query the collection separately. 在您的情况下,您可以将每个表建模为一个文档,然后分别查询集合。 If you have to query which books do not have a shop assigned to them, you have to go for denormalizing your tables and creating a different schema combining the entities from the two tables. 如果必须查询哪些书没有分配商店,则必须去规范化表并创建将两个表中的实体结合起来的不同模式。 (or n tables). (或n个表)。 Solr 4.0 allows join but because of that, do not take the route of modelling the relational database schema directly on to solr schema Solr 4.0允许加入,但因此,不要在solr模式上直接采用将关系数据库模式建模的途径

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

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