vsop-479 commented on PR #15823: URL: https://github.com/apache/lucene/pull/15823#issuecomment-4146805817
> This is how it's used in the disj scorer, so only allow to initialize. Later calling addAll would lead to trouble. So basically a factory method like: produce a PQ with that size and take the elements from that stream. AddAll should not be allowed when heap is already populated because code may misuse it and fail suddenly. > @uschindler - I don't completely follow your comment about addAll only working on a newly-constructed/empty heap. Can you elaborate a bit? I believe both of the addAll methods (existing and this proposed one) should work correctly on a heap that already contains some elements, but I might be missing something? Or maybe I'm misunderstanding your point? Oh wait, after re-reading, maybe you're describing a different option that would appropriately size a new heap for a provided stream? One that would handle the overflow case by essentially allocating a bigger PQ? I am trying to understand this too :) -- 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]
