You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2017/01/31 14:03:45 UTC

[2/2] lucene-solr:branch_6x: LUCENE-7640: Fix test bug: the count may be `2*maxPointsInLeafNode` if the value is used as a split value.

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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d38b322b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d38b322b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d38b322b

Branch: refs/heads/branch_6x
Commit: d38b322b259b145c6c22aad52d8cce8c98d392a9
Parents: 0acddf4
Author: Adrien Grand <jp...@gmail.com>
Authored: Tue Jan 31 15:00:09 2017 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Tue Jan 31 15:03:03 2017 +0100

----------------------------------------------------------------------
 .../lucene/codecs/lucene60/TestLucene60PointsFormat.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d38b322b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java
----------------------------------------------------------------------
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 37d0b8e..c13d0da 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("f", new IntersectVisitor() {
+    // in general, or maybe 2x that if the point is a split value
+    final long pointCount = points.estimatePointCount("f", 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();