You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2017/02/01 17:00:54 UTC

[26/35] lucene-solr:jira/solr-8593: 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/d8d61ff6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d8d61ff6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d8d61ff6

Branch: refs/heads/jira/solr-8593
Commit: d8d61ff61d1d798f5e3853ef66bc485d0d403f18
Parents: 2e65101
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:00:09 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/d8d61ff6/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 8f0be3a..b4bfcbe 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();