LUCENE-10629: Fix NullPointerException.

I hit a NPE while running tests. `Weight#scorer` may return `null`, but not
`Scorer#iterator`.
This commit is contained in:
Adrien Grand 2022-08-01 14:13:22 +02:00
parent 7ac75135b9
commit 04e4f317cb
1 changed files with 2 additions and 2 deletions

View File

@ -73,11 +73,11 @@ public abstract class FacetCountsWithFilterQuery extends Facets {
final Weight fastMatchWeight =
searcher.createWeight(searcher.rewrite(fastMatchQuery), ScoreMode.COMPLETE_NO_SCORES, 1);
final Scorer s = fastMatchWeight.scorer(hits.context);
DocIdSetIterator fastMatchQueryIterator = s.iterator();
if (fastMatchQueryIterator == null) {
if (s == null) {
// no matching docs by the fast match query
return null;
} else {
DocIdSetIterator fastMatchQueryIterator = s.iterator();
allIterators.add(fastMatchQueryIterator);
}
}