iprithv commented on code in PR #16180:
URL: https://github.com/apache/lucene/pull/16180#discussion_r3659812026
##########
lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java:
##########
@@ -95,6 +96,34 @@ public TermsEnum termsEnum() throws IOException {
return new SortedDocValuesTermsEnum(this);
}
+ /**
+ * Fills {@code bitSet} with the doc IDs in {@code [fromDoc, toDoc)} whose
ordinals are in {@code
+ * [minOrd, maxOrd]}. This is a bulk operation that avoids per-doc virtual
dispatch overhead.
+ *
+ * <p>The default implementation falls back to per-doc evaluation via {@link
#advanceExact} and
+ * {@link #ordValue}. Subclasses with random-access storage (e.g., dense
fixed-bitsPerValue
+ * fields) can override this for significantly better performance.
+ *
+ * @param fromDoc first doc ID to evaluate (inclusive)
+ * @param toDoc last doc ID to evaluate (exclusive)
+ * @param minOrd lower bound of the ordinal range (inclusive)
+ * @param maxOrd upper bound of the ordinal range (inclusive)
+ * @param bitSet the bitset to fill
+ * @param offset subtracted from each doc ID before setting the bit
+ */
+ public void ordinalRangeIntoBitSet(
+ int fromDoc, int toDoc, long minOrd, long maxOrd, FixedBitSet bitSet,
int offset)
+ throws IOException {
+ for (int d = fromDoc; d < toDoc; d++) {
+ if (advanceExact(d)) {
Review Comment:
makes sense, switched from per-doc advanceExact to the advance()/nextDoc()
iteration pattern. 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: [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]