You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/08/09 04:12:18 UTC

[GitHub] [lucene] zacharymorn commented on a diff in pull request #1039: LUCENE-10635: Ensure test coverage for WANDScorer by using a test query

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