1> I'd add a field "type" (or something) that had some way to
distinguish the two records. Consider "product" and "company" for the
two field values. As Alexandre said, internally these are _separate_
records.

2> Each record needs a unique ID (<uniqueKey> in your schema). If you
don't, subsequent records will replace previous ones.

You asked about nested documents and that's what Alexandre gave you,
but have you consider denormalizing the data? That is, store the
company info with each separate product? If possible that's usually
preferred.

Here are some references:
http://yonik.com/solr-nested-objects/
https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers#UploadingDatawithIndexHandlers-NestedChildDocuments

Best,
Erick

On Mon, Oct 24, 2016 at 6:05 AM, Preeti Bhat <preeti.b...@shoregrp.com> wrote:
> 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:arafa...@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 <preeti.b...@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....@dba.com} , {CompanyId:4,
>> email:abc....@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-supp...@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-supp...@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.
>
>

Reply via email to