s1monw commented on code in PR #12829: URL: https://github.com/apache/lucene/pull/12829#discussion_r1434195239
########## lucene/core/src/java/org/apache/lucene/index/IndexingChain.java: ########## @@ -219,15 +224,41 @@ private Sorter.DocMap maybeSortSegment(SegmentWriteState state) throws IOExcepti } LeafReader docValuesReader = getDocValuesLeafReader(); - + Function<IndexSorter.DocComparator, IndexSorter.DocComparator> comparatorWrapper = in -> in; + + if (state.segmentInfo.getHasBlocks() && state.fieldInfos.getParentField() != null) { + final DocIdSetIterator readerValues = + docValuesReader.getNumericDocValues(state.fieldInfos.getParentField()); + if (readerValues == null) { + throw new CorruptIndexException( + "missing doc values for parent field \"" + state.fieldInfos.getParentField() + "\"", + "IndexingChain"); + } + BitSet parents = BitSet.of(readerValues, state.segmentInfo.maxDoc()); + comparatorWrapper = + in -> + (docID1, docID2) -> + in.compare(parents.nextSetBit(docID1), parents.nextSetBit(docID2)); + } + if (state.segmentInfo.getHasBlocks() + && state.fieldInfos.getParentField() == null + && indexCreatedVersionMajor >= Version.LUCENE_10_0_0.major) { + throw new CorruptIndexException( + "parent field is not set but the index has blocks. indexCreatedVersionMajor: " + + indexCreatedVersionMajor, + "IndexingChain"); Review Comment: Oh yeah but this check only happens when you use sorting... I will fix the wording -- 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