zacharymorn commented on a change in pull request #2141:
URL: https://github.com/apache/lucene-solr/pull/2141#discussion_r549545837



##########
File path: lucene/core/src/java/org/apache/lucene/search/WANDScorer.java
##########
@@ -130,10 +130,19 @@ private static long scaleMinScore(float minScore, int 
scalingFactor) {
 
   int upTo; // upper bound for which max scores are valid
 
-  WANDScorer(Weight weight, Collection<Scorer> scorers) throws IOException {
+  int minShouldMatch;
+  int freq;
+
+  WANDScorer(Weight weight, Collection<Scorer> scorers, int minShouldMatch) 
throws IOException {
     super(weight);
 
+    if (minShouldMatch > scorers.size()) {
+      throw new IllegalArgumentException("minShouldMatch should be <= the 
number of scorers");
+    }
+
     this.minCompetitiveScore = 0;
+    this.minShouldMatch = minShouldMatch > 0 ? minShouldMatch : 0;

Review comment:
       I put it there originally to guard against any accidental invalid 
negative minShouldMatch being passed in, but yeah it should probably be handled 
as assertion. I've updated it. 




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

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