zkendall commented on code in PR #2799:
URL: https://github.com/apache/solr/pull/2799#discussion_r1818180533


##########
solr/core/src/java/org/apache/solr/update/SolrIndexSplitter.java:
##########
@@ -125,17 +126,33 @@ public SolrIndexSplitter(SplitIndexCommand cmd) {
       numPieces = cmd.ranges.size();
       rangesArr = cmd.ranges.toArray(new DocRouter.Range[0]);
     }
+
+    SchemaField maybeField;
     if (cmd.routeFieldName == null) {
-      field = searcher.getSchema().getUniqueKeyField();
+      // To support routing child documents, use the root field if it exists 
(which would be
+      // populated with unique field), otherwise use the unique key field
+      if (searcher.getSchema().isUsableForChildDocs()) {
+        maybeField = 
searcher.getSchema().getFieldOrNull(IndexSchema.ROOT_FIELD_NAME);
+      } else {
+        maybeField = searcher.getSchema().getUniqueKeyField();
+      }
     } else {
-      field = searcher.getSchema().getField(cmd.routeFieldName);
+      // Custom routing
+      // This may not route child documents the same as parents; users are 
expected to manage this

Review Comment:
   I dig it. (Except changing to "consistent routeField value")



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to