jpountz commented on a change in pull request #2141: URL: https://github.com/apache/lucene-solr/pull/2141#discussion_r546262588
########## 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()) { Review comment: maybe we should make sure the minShouldMatch is not equal either, since it would be better to use the conjunction scorer otherwise? ########## File path: lucene/core/src/java/org/apache/lucene/search/WANDScorer.java ########## @@ -271,6 +280,19 @@ public boolean matches() throws IOException { return false; } } + + // minCompetitiveScore satisfied, now checks if the doc has enough required number of matches + // Combining this loop with the above makes for complicated conditional checks, so keeping them separate for readability Review comment: Actually I think it's important to merge both loops, in order to stop calling `advanceTail` as soon as possible. Without doing this, your change is still correct, but it doesn't leverage `minShouldMatch` in order to make the query run faster, which is a shame. ########## 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: this line is suspicious, in minShouldMatch ever negative? ---------------------------------------------------------------- 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