You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by subacini Arunkumar <su...@gmail.com> on 2013/11/30 09:36:48 UTC

single solr document with all fields from two different document types

Hi

 Please let me know the possible solutions to address my requirement.

* Two tables might have millions of records with 50 columns in each table

* Expected output is same as what we get in SQL inner join

say For Eg, I have two tables  Product , Order table.

*Product Table *

id Name

P1    ipad

P2    iphone 4

P3    iphone 5

*Order Table*

id      order date      product_id

O1     1-Dec-2012     P1

O2     1-Dec-2012    P2

O3     2-Dec-2012   P2


*Expected Output: *I want to show the details in UI as below [SQL inner
join ]

O1    01-Dec-2012  ipad

O2     1-Dec-2012   iPhone 4

O3     2-Dec-2012   iPhone 5


I tried setting up two solr cores , Product core & Order Core

*Option 1: Using Solr Join*

I got expected result but i was able to get columns only from one core (ie)
total 3 records but only product table columns


http://<….>/product/select?q=*&fq={!join from=product_id to=id
fromIndex=order}*


*Option 2:  Using shards*

Created third core, but number of records is sum of(Product core + Order
Core) as documents are of different types and they are all unique(ie) 6
records

So how could i generate a single document with all fields from two
different document types in different cores.