s1monw commented on code in PR #12685:
URL: https://github.com/apache/lucene/pull/12685#discussion_r1360837043


##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -3368,9 +3368,15 @@ public void addIndexesReaderMerge(MergePolicy.OneMerge 
merge) throws IOException
     String mergedName = newSegmentName();
     Directory mergeDirectory = mergeScheduler.wrapForMerge(merge, directory);
     int numSoftDeleted = 0;
+    boolean hasBlocks = false;
     for (MergePolicy.MergeReader reader : merge.getMergeReader()) {
       CodecReader leaf = reader.codecReader;
       numDocs += leaf.numDocs();
+      if (reader.reader == null) {
+        hasBlocks = true; // NOCOMMIT: can we just assume that it has blocks 
and go with worst case here?

Review Comment:
   ```JAVA
       if (reader.reader == null) {
           CodecReader unwrap = FilterCodecReader.unwrap(leaf);
           if (SegmentReader.class.isAssignableFrom(unwrap.getClass())) {
             hasBlocks = ((SegmentReader) 
unwrap).getSegmentInfo().info.getHasBlocks();
           } else {
             hasBlocks = false;
           }
         } else {
           hasBlocks |= reader.reader.getSegmentInfo().info.getHasBlocks();
         }
   ```
   
   this would be another option for best effort



-- 
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