Is Solr 4.0 capable of using join for multiple cores?

I notice that Solr 4.0 introduced the "join" function for documents with relationships. this is great, but I notice the examples provided by http://wiki.apache.org/solr/Join for a single core, all documents of which are in the same index.

Does anyone know if I can use "join" for multiple cores?

+23
source share
1 answer

This comment says you can use:

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

I tried it myself, and here is a more detailed example: They 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 means something like:

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

The result will be: {id: "1", name: "Apple"}

+41
source

Source: https://habr.com/ru/post/944040/


All Articles