本文介绍了Solr 4.0 是否能够使用“join"?多核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到 Solr 4.0 为具有关系的文档引入了加入"功能.这很好,但是,我注意到 http://wiki.apache.org/solr/Join 用于单核,所有文档都在单个索引中.

I notice Solr 4.0 has introduced 'join' feature for documents having relationships. this is great, however, I notice examples given by http://wiki.apache.org/solr/Join are for single core which all documents are in single index.

有人知道我是否可以将加入"用于多核?

Does anybody know if I can use 'join' for multiple core?

推荐答案

此评论 表示可以使用:

{!join from=fromField to=toField fromIndex=fromCoreName}fromQuery

我自己试过,这里有一个更详细的例子:有两个核心

I tried it myself, and here's a more detailed example:Have two cores

  • 品牌 {id,name}
  • 产品 {id, name,brand_id}

品牌:{1、苹果}、{2、三星}、{3、HTC}

BRANDS: {1, Apple}, {2, Samsung}, {3, HTC}

产品:{1, iPhone, 1}, {2, iPad, 1}, {3, Galaxy S3, 2}, {4, Galaxy Note, 2}, {5, OneX, 3}

PRODUCTS: {1, iPhone, 1}, {2, iPad, 1}, {3, Galaxy S3, 2}, {4, Galaxy Note, 2}, {5, One X, 3}

http://example.com:8999/solr/brands/select?q=*:*&fq={!join from=brand_id to=id fromIndex=products}name:iPad

http://example.com:8999/solr/brands/select?q=*:*&fq={!join from=brand_id to=id fromIndex=products}name:iPad

这可以转化为:

SELECT b.* FROM brands b
       INNER JOIN products p ON b.id=p.brand_id
       WHERE p.name="iPad";

结果将是:{id: "1", name:"Apple"}

Result will be: {id: "1", name:"Apple"}

这篇关于Solr 4.0 是否能够使用“join"?多核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 06:58