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 Preeti Bhat <pr...@shoregrp.com> on 2016/10/24 09:46:24 UTC

Using nested subdocuments in SOLR

HI All,

I have a requirement which needs the documents to be stored in the below format. Could someone please advise on whether this is possible in SOLR?

{
Id:1
Name:"ABC"
CompanyLink:[ {CompanyId:2, email:abc.bcd@dba.com}
, {CompanyId:4, email:abc.bcd@dbcc.com}
                        ]
}

Is this achievable through SOLRJ? Also, is there any expected impact on performance of the search or index due to storage in this format?


Thanks and Regards,
Preeti Bhat



NOTICE TO RECIPIENTS: This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender and it-support@shoregrp.com immediately, and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.



RE: Using nested subdocuments in SOLR

Posted by Preeti Bhat <pr...@shoregrp.com>.
HI Alexandre,

I have below questions.
1) need to tag your parent/child documents with document type-> What do we mean by this? Should this be done in the schema.xml /managed-schema.
2) When we say individual id's what do we mean? I am asking this because, I might have the child ids and parent ids as same. For example, the Company Link Id could be 1 and so could be id=1


Thanks and Regards,
Preeti Bhat

-----Original Message-----
From: Alexandre Rafalovitch [mailto:arafalov@gmail.com]
Sent: Monday, October 24, 2016 6:06 PM
To: solr-user
Subject: Re: Using nested subdocuments in SOLR

(tl;dr) Yes

Solr supports nested documents, with the company link instances becoming children records/documents. However, they are stored separately, so the parent and child documents would be searched and return separately unless you use appropriate queries, document transformers, etc.

You'd also need to tag your parent/child documents with document type (obviously, CompanyLink for child documents here) and assign individual IDs.

SolrJ supports nested documents too.

Regards,
   Alex.
----
Solr Example reading group is starting November 2016, join us at http://j.mp/SolrERG Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 24 October 2016 at 05:46, Preeti Bhat <pr...@shoregrp.com> wrote:
> HI All,
>
> I have a requirement which needs the documents to be stored in the below format. Could someone please advise on whether this is possible in SOLR?
>
> {
> Id:1
> Name:"ABC"
> CompanyLink:[ {CompanyId:2, email:abc.bcd@dba.com} , {CompanyId:4,
> email:abc.bcd@dbcc.com}
>                         ]
> }
>
> Is this achievable through SOLRJ? Also, is there any expected impact on performance of the search or index due to storage in this format?
>
>
> Thanks and Regards,
> Preeti Bhat
>
>
>
> NOTICE TO RECIPIENTS: This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender and it-support@shoregrp.com immediately, and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>
>

NOTICE TO RECIPIENTS: This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender and it-support@shoregrp.com immediately, and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.



Re: Using nested subdocuments in SOLR

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
(tl;dr) Yes

Solr supports nested documents, with the company link instances
becoming children records/documents. However, they are stored
separately, so the parent and child documents would be searched and
return separately unless you use appropriate queries, document
transformers, etc.

You'd also need to tag your parent/child documents with document type
(obviously, CompanyLink for child documents here) and assign
individual IDs.

SolrJ supports nested documents too.

Regards,
   Alex.
----
Solr Example reading group is starting November 2016, join us at
http://j.mp/SolrERG
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 24 October 2016 at 05:46, Preeti Bhat <pr...@shoregrp.com> wrote:
> HI All,
>
> I have a requirement which needs the documents to be stored in the below format. Could someone please advise on whether this is possible in SOLR?
>
> {
> Id:1
> Name:"ABC"
> CompanyLink:[ {CompanyId:2, email:abc.bcd@dba.com}
> , {CompanyId:4, email:abc.bcd@dbcc.com}
>                         ]
> }
>
> Is this achievable through SOLRJ? Also, is there any expected impact on performance of the search or index due to storage in this format?
>
>
> Thanks and Regards,
> Preeti Bhat
>
>
>
> NOTICE TO RECIPIENTS: This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender and it-support@shoregrp.com immediately, and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>
>