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

后端 未结 1 1654
面向向阳花
面向向阳花 2020-12-01 08:22

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

相关标签:
1条回答
  • 2020-12-01 08:51

    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"}

    0 讨论(0)
提交回复
热议问题