zkendall commented on code in PR #2686: URL: https://github.com/apache/lucene-solr/pull/2686#discussion_r1799751372
########## solr/core/src/java/org/apache/solr/update/SolrIndexSplitter.java: ########## @@ -130,9 +131,26 @@ public SolrIndexSplitter(SplitIndexCommand cmd) { } routeFieldName = cmd.routeFieldName; if (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 + field = searcher.getSchema().getFieldOrNull(IndexSchema.ROOT_FIELD_NAME); + if(field == null) { + field = searcher.getSchema().getUniqueKeyField(); + } } else { - field = searcher.getSchema().getField(routeFieldName); + SchemaField uniqueField = searcher.getSchema().getUniqueKeyField(); + if (uniqueField.getName().equals(routeFieldName)) { + // Explicitly routing based on unique field + // 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 + field = searcher.getSchema().getFieldOrNull(IndexSchema.ROOT_FIELD_NAME); + if (field == null) { + field = searcher.getSchema().getUniqueKeyField(); + } + } else { + // Custom routing + field = searcher.getSchema().getField(routeFieldName); + } Review Comment: It kinda seems like the opposite. The routeFieldName seems to be pre-populated by the zk collection state (not from split caller (api doesn't support setting afaict)). Doesn't that mean it'll usually be set or at least could be set enough to support it? (I believe my use-case does, but I'll learn more when I setup e2e test in this thing.) https://github.com/apache/lucene-solr/blob/2d63a9d1208bbf950135b90496268b0a40e119b5/solr/core/src/java/org/apache/solr/handler/admin/SplitOp.java#L118-L135 -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org