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 Sebastian Riemer <s....@littera.eu> on 2016/03/08 20:05:24 UTC

Duplicate Document IDs when updateing parent document with child document

Hi,

I have created a simple Java application which illustrates this issue.

I am using Solr-Version 5.5.0 and SolrJ.

Here is a link to the github repository: https://github.com/sebastianriemer/SolrDuplicateTest

The issue I am facing is also described by another person on stackoverflow: http://stackoverflow.com/questions/34253178/solr-doesnt-overwrite-duplicated-uniquekey-entries

I would love if any of you could run the test at your place and give me feedback.

If you have any questions do not hesitate to write me.

Many thanks in advance and best regards,

Sebastian Riemer




Re: Duplicate Document IDs when updateing parent document with child document

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello Sebastian,

Mixing standalone docs and blocks doesn't work. There are a plenty of
issues open.

On Wed, Mar 9, 2016 at 3:02 PM, Sebastian Riemer <s....@littera.eu>
wrote:

> Hi,
>
> to actually describe my problem in short, instead of just linking to the
> test applicaton, using SolrJ I do the following:
>
> 1) Create a new document as a parent and commit
>         SolrInputDocument parentDoc = new SolrInputDocument();
>         parentDoc.addField("id", "parent_1");
>         parentDoc.addField("name_s", "Sarah Connor");
>         parentDoc.addField("blockJoinId", "1");
>         solrClient.add(parentDoc);
>         solrClient.commit();
>
> 2) Create a new document with the same unique-id as in 1) with a child
> document appended
>         SolrInputDocument parentDocUpdateing = new SolrInputDocument();
>         parentDocUpdateing.addField("id", "parent_1");
>         parentDocUpdateing.addField("name_s", "Sarah Connor");
>         parentDocUpdateing.addField("blockJoinId", "1");
>
>         SolrInputDocument childDoc = new SolrInputDocument();
>         childDoc.addField("id", "child_1");
>         childDoc.addField("name_s", "John Connor");
>         childDoc.addField("blockJoinId", "1");
>
>         parentDocUpdateing.addChildDocument(childDoc);
>         solrClient.add(parentDocUpdateing);
>         solrClient.commit();
>
> 3) Results in 2 Documents with id="parent_1" in solr index
>
> Is this normal behaviour? I thought the existing document should be
> updated instead of generating a new document with same id.
>
> For a full working test application please see orginal message.
>
> Best regards,
> Sebastian
>
> -----Ursprüngliche Nachricht-----
> Von: Sebastian Riemer [mailto:s.riemer@littera.eu]
> Gesendet: Dienstag, 8. März 2016 20:05
> An: solr-user@lucene.apache.org
> Betreff: Duplicate Document IDs when updateing parent document with child
> document
>
> Hi,
>
> I have created a simple Java application which illustrates this issue.
>
> I am using Solr-Version 5.5.0 and SolrJ.
>
> Here is a link to the github repository:
> https://github.com/sebastianriemer/SolrDuplicateTest
>
> The issue I am facing is also described by another person on
> stackoverflow:
> http://stackoverflow.com/questions/34253178/solr-doesnt-overwrite-duplicated-uniquekey-entries
>
> I would love if any of you could run the test at your place and give me
> feedback.
>
> If you have any questions do not hesitate to write me.
>
> Many thanks in advance and best regards,
>
> Sebastian Riemer
>
>
>
>


-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
<mk...@griddynamics.com>

AW: Duplicate Document IDs when updateing parent document with child document

Posted by Sebastian Riemer <s....@littera.eu>.
Hi,

to actually describe my problem in short, instead of just linking to the test applicaton, using SolrJ I do the following:

1) Create a new document as a parent and commit
	SolrInputDocument parentDoc = new SolrInputDocument();
	parentDoc.addField("id", "parent_1");
	parentDoc.addField("name_s", "Sarah Connor");
	parentDoc.addField("blockJoinId", "1");
	solrClient.add(parentDoc);
	solrClient.commit();

2) Create a new document with the same unique-id as in 1) with a child document appended
	SolrInputDocument parentDocUpdateing = new SolrInputDocument();
	parentDocUpdateing.addField("id", "parent_1");
	parentDocUpdateing.addField("name_s", "Sarah Connor");
	parentDocUpdateing.addField("blockJoinId", "1");

	SolrInputDocument childDoc = new SolrInputDocument();
	childDoc.addField("id", "child_1");
	childDoc.addField("name_s", "John Connor");
	childDoc.addField("blockJoinId", "1");

	parentDocUpdateing.addChildDocument(childDoc);
	solrClient.add(parentDocUpdateing);
	solrClient.commit();

3) Results in 2 Documents with id="parent_1" in solr index

Is this normal behaviour? I thought the existing document should be updated instead of generating a new document with same id.

For a full working test application please see orginal message.

Best regards,
Sebastian

-----Ursprüngliche Nachricht-----
Von: Sebastian Riemer [mailto:s.riemer@littera.eu] 
Gesendet: Dienstag, 8. März 2016 20:05
An: solr-user@lucene.apache.org
Betreff: Duplicate Document IDs when updateing parent document with child document

Hi,

I have created a simple Java application which illustrates this issue.

I am using Solr-Version 5.5.0 and SolrJ.

Here is a link to the github repository: https://github.com/sebastianriemer/SolrDuplicateTest

The issue I am facing is also described by another person on stackoverflow: http://stackoverflow.com/questions/34253178/solr-doesnt-overwrite-duplicated-uniquekey-entries

I would love if any of you could run the test at your place and give me feedback.

If you have any questions do not hesitate to write me.

Many thanks in advance and best regards,

Sebastian Riemer