romseygeek commented on issue #1351: LUCENE-9280: Collectors to skip noncompetitive documents URL: https://github.com/apache/lucene-solr/pull/1351#issuecomment-608437953 I like the idea of wrapping things up, and I think we may be able to take this further by pushing more of the logic into the comparator: * add a `wrapDocIdSetIterator(DocIdSetIterator in)` method to `LeafCollector` that by default returns the passed-in iterator. This gets called in `DefaultBulkScorer#score` to wrap the iterator for a query. * add a `wrapDocIdSetIterator(DocIdSetIterator in)` method to `FieldComparator` that by default returns the passed-in iterator. `TopFieldCollector` delegates its `wrapDocIdSetIterator` method to this method on its first comparator. This allows us to completely contain the logic that combines a query's iterator with sorting shortcuts to the `SortField` and associated `FieldComparator` implementation. * Move the logic that checks whether or not to update the iterator into `setBottom` on the leaf comparator. I know this involves passing the `HitsThresholdChecker` into the leaf comparator constructor, but I think that's reasonable if the point of this API change is to make it possible for comparators to skip hits
---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org