You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2020/04/07 08:47:48 UTC

[lucene-solr] branch branch_8x updated: LUCENE-9244: In 2D, a point can be shared by four leaves (#1279)

This is an automated email from the ASF dual-hosted git repository.

ivera pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new b03863f  LUCENE-9244: In 2D, a point can be shared by four leaves (#1279)
b03863f is described below

commit b03863f4683344fb5f27c5b36d19c3096d431ac5
Author: Ignacio Vera <iv...@apache.org>
AuthorDate: Tue Apr 7 10:41:15 2020 +0200

    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
---
 lucene/CHANGES.txt                                            |  3 +++
 .../lucene/codecs/lucene60/TestLucene60PointsFormat.java      | 11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 7559e9d..f0736e8 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -64,6 +64,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
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 23ce077..91c0966 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
@@ -300,12 +300,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) {