jpountz commented on code in PR #12846: URL: https://github.com/apache/lucene/pull/12846#discussion_r1447359065
########## lucene/core/src/java/org/apache/lucene/codecs/CompetitiveImpactAccumulator.java: ########## @@ -93,6 +93,20 @@ public void addAll(CompetitiveImpactAccumulator acc) { assert assertConsistent(); } + /** Copy {@code acc} into this empty acc. */ + public void copy(CompetitiveImpactAccumulator acc) { + assert Arrays.stream(maxFreqs).sum() == 0; + assert otherFreqNormPairs.isEmpty(); Review Comment: Sorry I have not been clear in previous comments, but the thing that bugs me a bit is this assertion that the accumulator is currently empty that gives a contract to this method that is surprising to me: why should the object currently be empty? When I look at other `copy()` methods we have, like `BytesRefBuilder#copy`, they don't expect the current object to be empty, it is expected to behave like a `clear()` followed by an `append()` (or `addAll()` for this accumulator). And it looks like we can easily have a similar contract here? -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org