You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2022/09/01 22:53:10 UTC

[lucene] branch branch_9x updated: Ensure TermInSetQuery ScoreSupplier never returns null Scorer

This is an automated email from the ASF dual-hosted git repository.

gsmiller pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 130759a2ec3 Ensure TermInSetQuery ScoreSupplier never returns null Scorer
130759a2ec3 is described below

commit 130759a2ec31d959c06c012e27a9a7ace1aa0ef4
Author: Greg Miller <gs...@gmail.com>
AuthorDate: Thu Sep 1 15:31:14 2022 -0700

    Ensure TermInSetQuery ScoreSupplier never returns null Scorer
---
 lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java b/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
index b09fc9f8b3c..a0016d61ba7 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TermInSetQuery.java
@@ -382,12 +382,10 @@ public class TermInSetQuery extends Query implements Accountable {
           @Override
           public Scorer get(long leadCost) throws IOException {
             WeightOrDocIdSet weightOrDocIdSet = rewrite(context);
-            if (weightOrDocIdSet == null) {
-              return null;
-            }
-
             final Scorer scorer;
-            if (weightOrDocIdSet.weight != null) {
+            if (weightOrDocIdSet == null) {
+              scorer = null;
+            } else if (weightOrDocIdSet.weight != null) {
               scorer = weightOrDocIdSet.weight.scorer(context);
             } else {
               scorer = scorer(weightOrDocIdSet.set);