jpountz commented on a change in pull request #736:
URL: https://github.com/apache/lucene/pull/736#discussion_r825981973



##########
File path: 
lucene/sandbox/src/java/org/apache/lucene/sandbox/search/IndexSortSortedNumericDocValuesRangeQuery.java
##########
@@ -198,16 +198,22 @@ public boolean isCacheable(LeafReaderContext ctx) {
 
       @Override
       public int count(LeafReaderContext context) throws IOException {
-        BoundedDocSetIdIterator disi = getDocIdSetIteratorOrNull(context);
-        if (disi != null) {
-          return disi.lastDoc - disi.firstDoc;
+        Sort indexSort = context.reader().getMetaData().getSort();
+        if (indexSort != null
+            && indexSort.getSort().length > 0
+            && indexSort.getSort()[0].getField().equals(field)
+            && indexSort.getSort()[0].getMissingValue() == null) {

Review comment:
       I don't think that this is the right thing to check since the missing 
value is assumed to be zero if not set.
   
   The best thing we can do that I can think of is to check if the field is 
dense via points (ie. no missing values) or if the missing value falls outside 
of the range so that the bounded iterator is accurate?




-- 
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

Reply via email to