Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/501#discussion_r234496354
  
    --- Diff: solr/core/src/java/org/apache/solr/update/AddUpdateCommand.java 
---
    @@ -194,20 +203,22 @@ public String getHashableId() {
           return null; // caller should call getLuceneDocument() instead
         }
     
    -    String rootId = getHashableId();
    -
    -    boolean isVersion = version != 0;
    -
    +    final String rootId = getHashableId();
         for (SolrInputDocument sdoc : all) {
    -      sdoc.setField(IndexSchema.ROOT_FIELD_NAME, rootId);
    -      if(isVersion) sdoc.setField(CommonParams.VERSION_FIELD, version);
    -      // TODO: if possible concurrent modification exception (if 
SolrInputDocument not cloned and is being forwarded to replicas)
    -      // then we could add this field to the generated lucene document 
instead.
    +      addBlockId(sdoc, rootId);
         }
     
         return () -> all.stream().map(sdoc -> DocumentBuilder.toDocument(sdoc, 
req.getSchema())).iterator();
       }
     
    +  private void addBlockId(SolrInputDocument sdoc, String rootId) {
    +    boolean isVersion = version != 0;
    +    sdoc.setField(IndexSchema.ROOT_FIELD_NAME, rootId);
    +    if(isVersion) sdoc.setField(CommonParams.VERSION_FIELD, version);
    --- End diff --
    
    needs a comment as said in JIRA why we add the version here


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to