You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "s1monw (via GitHub)" <gi...@apache.org> on 2023/10/16 15:15:10 UTC
Re: [PR] Record if block API has been used in SegmentInfo [lucene]
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: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org