Github user dsmiley commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/385#discussion_r192623800
--- Diff:
solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java ---
@@ -952,12 +941,15 @@ public void split(SplitIndexCommand cmd) throws
IOException {
*
* @param cmd - cmd apply to IndexWriter
* @param writer - IndexWriter to use
- * @param updateTerm - used if this cmd results in calling {@link
IndexWriter#updateDocument}
*/
- private void updateDocOrDocValues(AddUpdateCommand cmd, IndexWriter
writer, Term updateTerm) throws IOException {
+ private Term updateDocOrDocValues(AddUpdateCommand cmd, IndexWriter
writer) throws IOException {
assert null != cmd;
final SchemaField uniqueKeyField =
cmd.req.getSchema().getUniqueKeyField();
final String uniqueKeyFieldName = null == uniqueKeyField ? null :
uniqueKeyField.getName();
+ List<SolrInputDocument> docs = cmd.computeFinalFlattenedSolrDocs();
+ boolean isBlock = docs.size() > 1;
+ Term idTerm = getIdTerm(cmd, isBlock);
+ Term updateTerm = cmd.hasUpdateTerm() ? cmd.updateTerm: idTerm;
if (cmd.isInPlaceUpdate()) {
--- End diff --
IMO since updateDocument is a method then the code here underneath
cmd.isInPlaceUpdate should be a method as well -- `updateDocValues` to be
balanced. Or inline updateDocument. (I know you didn't touch this)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]