Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

Is Solr 4.0 capable of using 'join" for multiple core?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

  • brands {id,name}
  • products {id, name, brand_id}

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

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

This translates to something like:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...