mirror of https://github.com/apache/lucene.git
LUCENE-7262: Fix NPE, this should lazy-init in start()
This commit is contained in:
parent
70bcd562f9
commit
91153b9627
|
@ -19,9 +19,6 @@ package org.apache.lucene.spatial.composite;
|
|||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.locationtech.spatial4j.shape.Shape;
|
||||
import org.locationtech.spatial4j.shape.SpatialRelation;
|
||||
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.queries.function.FunctionValues;
|
||||
import org.apache.lucene.queries.function.ValueSource;
|
||||
|
@ -38,6 +35,8 @@ import org.apache.lucene.spatial.prefix.AbstractVisitingPrefixTreeQuery;
|
|||
import org.apache.lucene.spatial.prefix.tree.Cell;
|
||||
import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
|
||||
import org.apache.lucene.util.DocIdSetBuilder;
|
||||
import org.locationtech.spatial4j.shape.Shape;
|
||||
import org.locationtech.spatial4j.shape.SpatialRelation;
|
||||
|
||||
/**
|
||||
* A spatial Intersects predicate that distinguishes an approximated match from an exact match based on which cells
|
||||
|
@ -163,8 +162,8 @@ public class IntersectsRPTVerifyQuery extends Query {
|
|||
// TODO consider if IntersectsPrefixTreeQuery should simply do this and provide both sets
|
||||
|
||||
class IntersectsDifferentiatingVisitor extends VisitorTemplate {
|
||||
DocIdSetBuilder approxBuilder = new DocIdSetBuilder(maxDoc, terms);
|
||||
DocIdSetBuilder exactBuilder = new DocIdSetBuilder(maxDoc, terms);
|
||||
DocIdSetBuilder approxBuilder;
|
||||
DocIdSetBuilder exactBuilder;
|
||||
boolean approxIsEmpty = true;
|
||||
boolean exactIsEmpty = true;
|
||||
DocIdSet exactDocIdSet;
|
||||
|
@ -176,6 +175,8 @@ public class IntersectsRPTVerifyQuery extends Query {
|
|||
|
||||
@Override
|
||||
protected void start() throws IOException {
|
||||
approxBuilder = new DocIdSetBuilder(maxDoc, terms);
|
||||
exactBuilder = new DocIdSetBuilder(maxDoc, terms);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.lucene.spatial.prefix;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.locationtech.spatial4j.shape.Shape;
|
||||
import org.apache.lucene.index.LeafReader;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.PostingsEnum;
|
||||
|
@ -35,6 +34,7 @@ import org.apache.lucene.search.Weight;
|
|||
import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
|
||||
import org.apache.lucene.util.BitSet;
|
||||
import org.apache.lucene.util.DocIdSetBuilder;
|
||||
import org.locationtech.spatial4j.shape.Shape;
|
||||
|
||||
/**
|
||||
* Base class for Lucene Queries on SpatialPrefixTree fields.
|
||||
|
@ -105,7 +105,7 @@ public abstract class AbstractPrefixTreeQuery extends Query {
|
|||
protected final LeafReaderContext context;
|
||||
protected final int maxDoc;
|
||||
|
||||
protected final Terms terms;
|
||||
protected final Terms terms; // maybe null
|
||||
protected final TermsEnum termsEnum;//remember to check for null!
|
||||
protected PostingsEnum postingsEnum;
|
||||
|
||||
|
|
Loading…
Reference in New Issue