jpountz commented on a change in pull request #746: LUCENE-8885: Optimise BKD
reader by exploiting cardinality information stored on leaves
URL: https://github.com/apache/lucene-solr/pull/746#discussion_r298797880
##########
File path: lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
##########
@@ -844,7 +845,28 @@ public void visit(int docID, byte[] packedValue) {
hits.set(docID);
}
- @Override
+ @Override
+ public void visit(DocIdSetIterator iterator, byte[] packedValue)
throws IOException {
+ if (random().nextBoolean()) {
+ //check the default method is correct
+ IntersectVisitor.super.visit(iterator, packedValue);
+ } else {
+ assertTrue(iterator.docID() == -1);
+ int cost = (int) iterator.cost();
+ int numberOfPoints = 0;
+ int docID;
+ while ((docID = iterator.nextDoc()) !=
DocIdSetIterator.NO_MORE_DOCS) {
+ visit(docID, packedValue);
+ numberOfPoints++;
+ }
+ assertTrue(cost == numberOfPoints);
+ assertTrue(iterator.docID() == DocIdSetIterator.NO_MORE_DOCS);
+ assertTrue(iterator.nextDoc() ==
DocIdSetIterator.NO_MORE_DOCS);
+ assertTrue(iterator.docID() == DocIdSetIterator.NO_MORE_DOCS);
Review comment:
can you use assertEquals here as well?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]