LUCENE-7211: Use DocIdSetBuilder instead of FixedBitSet in spatial RPT intersects predicate.

(cherry picked from commit f7f64c2)
This commit is contained in:
David Smiley 2016-04-13 10:39:09 -04:00
parent acf0a57940
commit ce094ebd76
2 changed files with 9 additions and 7 deletions

View File

@ -56,6 +56,9 @@ Optimizations
* LUCENE-7159: Speed up LatLonPoint polygon performance for complex
polygons. (Robert Muir)
* LUCENE-7211: Reduce memory & GC for spatial RPT Intersects when the number of
matching docs is small. (Jeff Wartes, David Smiley)
Bug Fixes
* LUCENE-7127: Fix corner case bugs in GeoPointDistanceQuery. (Robert Muir)

View File

@ -18,14 +18,13 @@ package org.apache.lucene.spatial.prefix;
import java.io.IOException;
import org.locationtech.spatial4j.shape.Shape;
import org.locationtech.spatial4j.shape.SpatialRelation;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.spatial.prefix.tree.Cell;
import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
import org.apache.lucene.util.BitDocIdSet;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.DocIdSetBuilder;
import org.locationtech.spatial4j.shape.Shape;
import org.locationtech.spatial4j.shape.SpatialRelation;
/**
* A Query matching documents that have an {@link SpatialRelation#INTERSECTS}
@ -53,16 +52,16 @@ public class IntersectsPrefixTreeQuery extends AbstractVisitingPrefixTreeQuery {
*/
return new VisitorTemplate(context) {
private FixedBitSet results;
private DocIdSetBuilder results;
@Override
protected void start() {
results = new FixedBitSet(maxDoc);
results = new DocIdSetBuilder(maxDoc);
}
@Override
protected DocIdSet finish() {
return new BitDocIdSet(results);
return results.build();
}
@Override