Nested documents is quite useful to model structural hierarchy data. 

Sometimes, we only have parent document which doesn't have child documents
yet, we want to add it first, and then later update it: re-add the whole
document including the parent documents and its all child documents.

But we found out that in the server, there would be two parent documents
with same id: one without child document, the other one which contains child
documents.

http://localhost:8983/solr/thecollection_shard1_replica2/select?q=id:*&fl=*,[docid]&distrib=false
<result name="response" numFound="3" start="0">
  <doc>
    <str name="docType">parent</str>
    <str name="id">9816c0f3-f3ae-4a7c-a5fe-89a2c481467a</str>
    <int name="[docid]">0</int>
  </doc>
  <doc>
    <str name="docType">child</str>
    <str name="id">e27d2709-2dc0-439d-b017-4d95212bf05f</str>
    <arr name="_root_">
      <str>9816c0f3-f3ae-4a7c-a5fe-89a2c481467a</str>
    </arr>
    <int name="[docid]">1</int>
  </doc>
  <doc>
    <str name="docType">parent</str>
    <str name="id">9816c0f3-f3ae-4a7c-a5fe-89a2c481467a</str>
    <arr name="_root_">
      <str>9816c0f3-f3ae-4a7c-a5fe-89a2c481467a</str>
    </arr>
    <int name="[docid]">2</int>
  </doc>
</result>

How I can avoid the duplicate parent documents?
How could I add a blocked document without child documents?

- I can workaround this by delete first before add new documents but the
performance would suffer

Thanks a lot for your help and response.




--
View this message in context: 
http://lucene.472066.n3.nabble.com/SolrJ-How-to-add-a-blocked-document-without-child-documents-tp4335006.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to