Skip to content

Commit 78dd964

Browse files
authored
Use cached cardinality for AcceptDocs cost (#15343)
* Use cached cardinality for AcceptDocs cost * adding changes
1 parent b3a2f33 commit 78dd964

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lucene/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ Optimizations
200200

201201
* GITHUB#15261: Implement longValues for MultiFieldNormValues to speedup CombinedQuery (Ge Song)
202202

203+
* GITHUB#15343: Ensure that `AcceptDocs#cost()` only ever calls `BitSets#cardinality()`
204+
once per instance to avoid redundant computation. (Ben Trent)
205+
203206
Bug Fixes
204207
---------------------
205208
* GITHUB#14161: PointInSetQuery's constructor now throws IllegalArgumentException

lucene/core/src/java/org/apache/lucene/search/AcceptDocs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public Bits bits() throws IOException {
190190
@Override
191191
public int cost() throws IOException {
192192
createBitSetAcceptDocsIfNecessary();
193-
return acceptBitSet.cardinality();
193+
return cardinality;
194194
}
195195

196196
@Override

0 commit comments

Comments
 (0)