lucene
lucene copied to clipboard
Stop double-checking priority queue inserts
Description
There are several occurrences in our code where we check that an incoming value can be inserted in a priority queue and then call insertWithOverflow
, which re-does the check. Let's stop checking before calling insertWithOverflow
.
Credit to @epotyom for noticing this in AbstractSortedSetDocValueFacetCounts
.
Maybe we can also extract out a common function from all the Facets
inserting into a priority queue, as @Shradha26 suggests.
Maybe we can also extract out a common function from all the
Facets
inserting into a priority queue, as @Shradha26 suggests.
I can't see a way to do this cleanly since e.g. StringValueFacetCounts
uses TopOrdAndIntQueue
while the TaxonomyFacets
abstract class uses TopOrdAndNumberQueue
which gets casted to int in setIncomingValue
. If we refactored this to a util method, we would lose the ability to override setIncomingValue
in the case of non-int queues.
I'll submit a PR for the issue in the initial description.