mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 03:25:15 +00:00
LUCENE-7640: Fix test failure.
This commit is contained in:
parent
9571d0f3ab
commit
c7fdd10971
@ -253,25 +253,28 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
|
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
|
||||||
assertEquals((actualMaxPointsInLeafNode + 1) / 2,
|
// in general, or maybe 2x that if the point is a split value
|
||||||
points.estimatePointCount(new IntersectVisitor() {
|
final long pointCount = points.estimatePointCount(new IntersectVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public void visit(int docID, byte[] packedValue) throws IOException {}
|
public void visit(int docID, byte[] packedValue) throws IOException {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(int docID) throws IOException {}
|
public void visit(int docID) throws IOException {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
|
public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
|
||||||
for (int dim = 0; dim < 2; ++dim) {
|
for (int dim = 0; dim < 2; ++dim) {
|
||||||
if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
|
if (StringHelper.compare(3, uniquePointValue[dim], 0, maxPackedValue, dim * 3) > 0 ||
|
||||||
StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
|
StringHelper.compare(3, uniquePointValue[dim], 0, minPackedValue, dim * 3) < 0) {
|
||||||
return Relation.CELL_OUTSIDE_QUERY;
|
return Relation.CELL_OUTSIDE_QUERY;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Relation.CELL_CROSSES_QUERY;
|
|
||||||
}
|
}
|
||||||
}));
|
return Relation.CELL_CROSSES_QUERY;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
assertTrue(""+pointCount,
|
||||||
|
pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
|
||||||
|
pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
|
||||||
|
|
||||||
r.close();
|
r.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
@ -1173,23 +1173,26 @@ public class TestBKD extends LuceneTestCase {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
|
// If only one point matches, then the point count is (actualMaxPointsInLeafNode + 1) / 2
|
||||||
assertEquals((actualMaxPointsInLeafNode + 1) / 2,
|
// in general, or maybe 2x that if the point is a split value
|
||||||
points.estimatePointCount(new IntersectVisitor() {
|
final long pointCount = points.estimatePointCount(new IntersectVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public void visit(int docID, byte[] packedValue) throws IOException {}
|
public void visit(int docID, byte[] packedValue) throws IOException {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(int docID) throws IOException {}
|
public void visit(int docID) throws IOException {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
|
public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
|
||||||
if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
|
if (StringHelper.compare(numBytesPerDim, uniquePointValue, 0, maxPackedValue, 0) > 0 ||
|
||||||
StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
|
StringHelper.compare(numBytesPerDim, uniquePointValue, 0, minPackedValue, 0) < 0) {
|
||||||
return Relation.CELL_OUTSIDE_QUERY;
|
return Relation.CELL_OUTSIDE_QUERY;
|
||||||
}
|
}
|
||||||
return Relation.CELL_CROSSES_QUERY;
|
return Relation.CELL_CROSSES_QUERY;
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
assertTrue(""+pointCount,
|
||||||
|
pointCount == (actualMaxPointsInLeafNode + 1) / 2 || // common case
|
||||||
|
pointCount == 2*((actualMaxPointsInLeafNode + 1) / 2)); // if the point is a split value
|
||||||
|
|
||||||
pointsIn.close();
|
pointsIn.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user