s1monw commented on code in PR #12829: URL: https://github.com/apache/lucene/pull/12829#discussion_r1440343745
########## lucene/core/src/java/org/apache/lucene/index/DocumentsWriterPerThread.java: ########## @@ -231,7 +244,23 @@ long updateDocuments( final int docsInRamBefore = numDocsInRAM; boolean allDocsIndexed = false; try { - for (Iterable<? extends IndexableField> doc : docs) { + final Iterator<? extends Iterable<? extends IndexableField>> iterator = docs.iterator(); + while (iterator.hasNext()) { + Iterable<? extends IndexableField> doc = iterator.next(); + if (parentField != null) { + if (iterator.hasNext() == false) { + doc = addParentField(doc, parentField); + } + } else if (segmentInfo.getIndexSort() != null + && iterator.hasNext() + && indexVersionCreated >= Version.LUCENE_10_0_0.major) { + // sort is configured but parent field is missing, yet we have a doc-block + // yet we must not fail if this index was created in an earlier version where this + // behavior was permitted. + throw new IllegalArgumentException( + "a parent field must be set in order to use document blocks with index sorting; see IndexWriterConfig#getParentField"); Review Comment: nah you are right -- 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