Apache Lucene open-source search software
LUCENE-7211: Use DocIdSetBuilder instead of FixedBitSet in spatial RPT intersects predicate.
David Smileyf7f64c21722e
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 87d039fba0d..58eee6ac4e9 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -63,6 +63,9 @@ Optimizations* LUCENE-7159: Speed up LatLonPoint polygon performance for complexpolygons. (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)diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeQuery.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeQuery.javaindex 89129a1c3fd..17c5a7ea1ec 100644--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeQuery.java+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/IntersectsPrefixTreeQuery.java@@ -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;@Overrideprotected void start() {- results = new FixedBitSet(maxDoc);+ results = new DocIdSetBuilder(maxDoc);}@Overrideprotected DocIdSet finish() {- return new BitDocIdSet(results);+ return results.build();}@Override