ErikPelli commented on code in PR #12034:
URL: https://github.com/apache/lucene/pull/12034#discussion_r1061649853
##########
lucene/core/src/java/org/apache/lucene/search/BlendedTermQuery.java:
##########
@@ -314,19 +314,15 @@ private static TermStates adjustFrequencies(
IndexReaderContext readerContext, TermStates ctx, int artificialDf, long
artificialTtf)
throws IOException {
List<LeafReaderContext> leaves = readerContext.leaves();
- final int len;
- if (leaves == null) {
- len = 1;
- } else {
- len = leaves.size();
- }
TermStates newCtx = new TermStates(readerContext);
- for (int i = 0; i < len; ++i) {
- TermState termState = ctx.get(leaves.get(i));
- if (termState == null) {
- continue;
+ if (leaves != null) {
Review Comment:
Ok, I missed that. In fact `IndexReaderContext` is an abstract class and the
classes that extend it (`CompositeReaderContext` and `LeafReaderContext`)
return a valid List or an exception.
So modify the doc is totaly fine, but it's needed also to remove the null
check of result of `IndexReaderContext#leaves()` method call, because it won't
ever happen.
--
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]