Skip to content

Apache Lucene open-source search software

LUCENE-7640: Fix test bug: the count may be `2*maxPointsInLeafNode` if the value is used as a split value.

Adrien Grandd8d61ff61d1d
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
index 8f0be3afcc7..b4bfcbe7aea 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
@@ -160,8 +160,8 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
}));
// If only one point matches, then the point count is (maxPointsInLeafNode + 1) / 2
- assertEquals((maxPointsInLeafNode + 1) / 2,
- points.estimatePointCount(new IntersectVisitor() {
+ // in general, or maybe 2x that if the point is a split value
+ final long pointCount = points.estimatePointCount(new IntersectVisitor() {
@Override
public void visit(int docID, byte[] packedValue) throws IOException {}
@@ -176,7 +176,10 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
}
return Relation.CELL_CROSSES_QUERY;
}
- }));
+ });
+ assertTrue(""+pointCount,
+ pointCount == (maxPointsInLeafNode + 1) / 2 || // common case
+ pointCount == 2*((maxPointsInLeafNode + 1) / 2)); // if the point is a split value
r.close();
dir.close();