mirror of https://github.com/apache/lucene.git
Build SpatialVisitor once per index (#11825)
Address a performance regression on polygon queries using LatLonPoint field.
This commit is contained in:
parent
971ae01164
commit
78b58b8e2e
|
@ -208,6 +208,7 @@ abstract class SpatialQuery extends Query {
|
||||||
@Override
|
@Override
|
||||||
public final Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) {
|
public final Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) {
|
||||||
final SpatialQuery query = this;
|
final SpatialQuery query = this;
|
||||||
|
final SpatialVisitor spatialVisitor = getSpatialVisitor();
|
||||||
return new ConstantScoreWeight(query, boost) {
|
return new ConstantScoreWeight(query, boost) {
|
||||||
@Override
|
@Override
|
||||||
public Scorer scorer(LeafReaderContext context) throws IOException {
|
public Scorer scorer(LeafReaderContext context) throws IOException {
|
||||||
|
@ -221,7 +222,7 @@ abstract class SpatialQuery extends Query {
|
||||||
@Override
|
@Override
|
||||||
public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException {
|
public ScorerSupplier scorerSupplier(LeafReaderContext context) throws IOException {
|
||||||
final LeafReader reader = context.reader();
|
final LeafReader reader = context.reader();
|
||||||
return getScorerSupplier(reader, getSpatialVisitor(), scoreMode, this, boost, score());
|
return getScorerSupplier(reader, spatialVisitor, scoreMode, this, boost, score());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue