magibney commented on a change in pull request #2:
URL: https://github.com/apache/solr/pull/2#discussion_r595182025
##########
File path: solr/core/src/java/org/apache/solr/search/BitDocSet.java
##########
@@ -237,68 +235,15 @@ public BitDocSet clone() {
return new BitDocSet(bits.clone(), size);
}
- @Override
- public Bits getBits(LeafReaderContext context) {
- if (context.isTopLevel) {
- return bits;
- }
-
- final int base = context.docBase;
- final int length = context.reader().maxDoc();
- final FixedBitSet bs = bits;
-
- return new Bits() {
- @Override
- public boolean get(int index) {
- return bs.get(index + base);
- }
-
- @Override
- public int length() {
- return length;
- }
- };
- }
-
- private static final int NO_DOCS_THIS_SEGMENT = -1;
- private int[] cachedFloorDocs;
-
- /**
- * Because `bits.nextSetBit(int)` (called in `nextDoc()`) has no upper
limit, lazily cache
- * floorDocs for each segment to avoid duplicate scanning of bits (and to
enable optimization
- * in consumers afforded by returning <code>null</code> when there are no
docs for a given
- * segment).
- */
private int getFloorDoc(final LeafReaderContext ctx) {
Review comment:
Ah, I wasn't sure whether you were taking issue with the "caching"
aspect of this optimization, or the entire idea of front-loading the first
"seek" on the bits.
----------------------------------------------------------------
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]