gsmiller commented on code in PR #12003: URL: https://github.com/apache/lucene/pull/12003#discussion_r1045104269
########## lucene/sandbox/src/java/org/apache/lucene/sandbox/search/IndexSortSortedNumericDocValuesRangeQuery.java: ########## @@ -212,9 +212,9 @@ public boolean isCacheable(LeafReaderContext ctx) { @Override public int count(LeafReaderContext context) throws IOException { if (context.reader().hasDeletions() == false) { - BoundedDocIdSetIterator disi = getDocIdSetIteratorOrNull(context); - if (disi != null && disi.delegate == null) { - return disi.lastDoc - disi.firstDoc; + DocIdSetIterator disi = getDocIdSetIteratorOrNull(context); + if (disi != null && disi instanceof BoundedDocIdSetIterator == false) { + return Math.toIntExact(disi.cost()); Review Comment: That's a great point. I'll work on making this less fragile. Thanks! -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org