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

    https://github.com/apache/lucene-solr/pull/385#discussion_r192622725
  
    --- Diff: 
solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java ---
    @@ -333,25 +331,18 @@ private void allowDuplicateUpdate(AddUpdateCommand 
cmd) throws IOException {
       }
     
       private void doNormalUpdate(AddUpdateCommand cmd) throws IOException {
    -    Term updateTerm;
    -    Term idTerm = getIdTerm(cmd);
    -    boolean del = false;
    -    if (cmd.updateTerm == null) {
    -      updateTerm = idTerm;
    -    } else {
    -      // this is only used by the dedup update processor
    -      del = true;
    -      updateTerm = cmd.updateTerm;
    -    }
    +    boolean del = cmd.hasUpdateTerm();
     
         RefCounted<IndexWriter> iw = solrCoreState.getIndexWriter(core);
         try {
           IndexWriter writer = iw.get();
     
    -      updateDocOrDocValues(cmd, writer, updateTerm);
    +      Term idTerm = updateDocOrDocValues(cmd, writer);
    +      Term updateTerm = !del ? idTerm : cmd.updateTerm;
    --- End diff --
    
    You can move this declaration closer to where you will actually use it, 
which is inside `if (del)`.  That in turn suggests it will in fact be 
cmd.updateTerm and not idTerm; right?


---

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

Reply via email to