LUCENE-9244: In 2D, a point can be shared by four leaves (#1279)

Adjust TestLucene60PointsFormat#testEstimatePointCount2Dims so it does not fail when a point is shared by multiple leaves
This commit is contained in:
Ignacio Vera 2020-04-07 10:41:15 +02:00 committed by GitHub
parent 9b6e072909
commit f018c4c813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -174,6 +174,9 @@ Other
* LUCENE-9275: Make TestLatLonMultiPolygonShapeQueries more resilient for CONTAINS queries. (Ignacio Vera)
* LUCENE-9244: Adjust TestLucene60PointsFormat#testEstimatePointCount2Dims so it does not fail when a point
is shared by multiple leaves. (Ignacio Vera)
======================= Lucene 8.5.0 =======================
API Changes

View File

@ -299,12 +299,13 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
return Relation.CELL_CROSSES_QUERY;
}
};
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
// in general, or maybe 2x that if the point is a split value
final long pointCount = points.estimatePointCount(onePointMatchVisitor);
assertTrue(""+pointCount,
pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
// The number of matches needs to be multiple of count per leaf
final long countPerLeaf = (actualMaxPointsInLeafNode + 1) / 2;
assertTrue(""+pointCount, pointCount % countPerLeaf == 0);
// in extreme cases, a point can be be shared by 4 leaves
assertTrue(""+pointCount, pointCount / countPerLeaf <= 4 && pointCount / countPerLeaf >= 1);
final long docCount = points.estimateDocCount(onePointMatchVisitor);
if (multiValues) {