zacharymorn commented on code in PR #1039:
URL: https://github.com/apache/lucene/pull/1039#discussion_r940876636


##########
lucene/core/src/test/org/apache/lucene/search/TestWANDScorer.java:
##########
@@ -815,7 +856,7 @@ private void doTestRandomSpecialMaxScore(float maxScore) 
throws IOException {
         }
         builder.add(query, Occur.SHOULD);
       }
-      Query query = builder.build();
+      Query query = numClauses > 0 ? new WANDScorerQuery(builder.build()) : 
builder.build();

Review Comment:
   Thanks for the suggestion! This case is actually trying to handle the 
scenario when there's 0 clause, upon which `WANDScorer` may throw assertion 
exception due to the following check: 
   
   ```
   if (minShouldMatch >= scorers.size()) {
       throw new IllegalArgumentException("minShouldMatch should be < the 
number of scorers");
   }
   ```
   However, upon digging further, I think the current code is still not enough, 
as `optionalScorers` can still have a size of 0 later on as well if there's no 
scorer for a clause for certain segment. I've updated it to 
https://github.com/apache/lucene/pull/1039/commits/511d1b2b2b6ffe8994d839a05830b2f629e0e0e3
 to catch that scenario as well.
   



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

Reply via email to