Solr 4.0是否可以使用"join"?对于多核? [英] Is Solr 4.0 capable of using 'join" for multiple core?
问题描述
我注意到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.
有人知道我是否可以对多核使用"join"吗?
Does anybody know if I can use 'join' for multiple core?
推荐答案
This comment says it's possible by using:
{!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,名称,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,一个X,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}名称: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",名称:"Apple"}
Result will be: {id: "1", name:"Apple"}
这篇关于Solr 4.0是否可以使用"join"?对于多核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!