You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Venkateswarlu Bommineni <bv...@gmail.com> on 2022/03/11 15:35:03 UTC

Joining 2 collections in SolrCloud setup

Hello All,

I am sending one more email with more details.

Solr is started in SlorCloud mode.

I have 2 collections.

collection1:
{
"id":"123",
"name":"name",
"description":"description"
}

collection2:
{
"id":"123",
"stock":"inStock",
"price":40
}

I am writing the joining as below and executing that query on *collection1*.

{!join method="crossCollection" fromIndex="*collection2*" from="id" to="id"
v="*:*"}

I am getting the results but only with the data from *collection1*

*Current Result:*
{
"id":"123",
"name":"name",
"description":"description"
}

Question: Is there any way we can get the data from both the collections ?
*Expected Results:*
{
"id":"123",
"name":"name",
"description":"description",
"stock":"inStock",
"price":40
}

Thanks,
Venkat.

Re: Joining 2 collections in SolrCloud setup

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello,  Venkat

Join is not proposed to return both sides, but only "to"-side. You can
either copy collection2 docs into collection1 docs (that ridiculous) or
apply
https://solr.apache.org/guide/6_6/transforming-result-documents.html#TransformingResultDocuments-_subquery_
. However, it applies to returned rows only and is really slow.

On Fri, Mar 11, 2022 at 6:35 PM Venkateswarlu Bommineni <bv...@gmail.com>
wrote:

> Hello All,
>
> I am sending one more email with more details.
>
> Solr is started in SlorCloud mode.
>
> I have 2 collections.
>
> collection1:
> {
> "id":"123",
> "name":"name",
> "description":"description"
> }
>
> collection2:
> {
> "id":"123",
> "stock":"inStock",
> "price":40
> }
>
> I am writing the joining as below and executing that query on
> *collection1*.
>
> {!join method="crossCollection" fromIndex="*collection2*" from="id" to="id"
> v="*:*"}
>
> I am getting the results but only with the data from *collection1*
>
> *Current Result:*
> {
> "id":"123",
> "name":"name",
> "description":"description"
> }
>
> Question: Is there any way we can get the data from both the collections ?
> *Expected Results:*
> {
> "id":"123",
> "name":"name",
> "description":"description",
> "stock":"inStock",
> "price":40
> }
>
> Thanks,
> Venkat.
>


-- 
Sincerely yours
Mikhail Khludnev