romseygeek commented on code in PR #16061:
URL: https://github.com/apache/lucene/pull/16061#discussion_r3234329229
##########
lucene/core/src/java/org/apache/lucene/document/SortedSetDocValuesRangeQuery.java:
##########
@@ -119,39 +119,31 @@ public ScorerSupplier scorerSupplier(LeafReaderContext
context) throws IOExcepti
}
DocValuesSkipper skipper = context.reader().getDocValuesSkipper(field);
SortedSetDocValues values = DocValues.getSortedSet(context.reader(),
field);
+ final SortedDocValues singleton = DocValues.unwrapSingleton(values);
+ if (singleton != null && skipper != null &&
isDensePrimarySort(context.reader(), skipper)) {
+ final long minOrd = minOrd(values);
+ final long maxOrd = maxOrd(values);
+ if (minOrd > maxOrd || minOrd > skipper.maxValue() || maxOrd <
skipper.minValue()) {
+ return null;
+ }
+ if (skipper.minValue() >= minOrd && skipper.maxValue() <= maxOrd) {
+ return ConstantScoreScorerSupplier.matchAll(
+ score(), scoreMode, context.reader().maxDoc());
+ }
+ final DocIdSetIterator psIterator =
+ getDocIdSetIteratorForDensePrimarySort(
Review Comment:
This is the bit that is called out as expensive below so I'm not sure if we
should be doing it in the `scorerSupplier` call directly? A couple of weeks
back [we were discussing ways of improving cost estimates using
skippers](https://github.com/apache/lucene/issues/15981#issuecomment-4350762426),
so I wonder if that's a better way to go?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]