I noticed what looks like a bug in TermsQuery.createWeight.scorer:
Good catch, it's a bad bug indeed! Here is an updated patch with a test that we only pull one iterator per unique field.
Secondly... I think the needsScores param should arguably not pass through to the ConstantScoreQuery wrapped BooleanQuery, since this should be constant scoring; no? Or maybe it's moot since it's CSQ after all.
Actually I think it does need to pass through to the CSQ. The current contract is that if you pass needsScores=false then scores are going to be undefined, so if the user passed needsScores=true we need to make sure that we build a query that will return the same scores.
By the way if we did not, it would probably break the scores since ConstantScoreQuery.createWeight returns the inner weight directly when scores are not needed.
Did you mean for the changes in CoalescedUpdates and FrozenBufferedUpdates to be in this patch?
Yes: I needed to have the term count to rewrite so I changed PrefixCodedTerms to store the number of wrapped terms and then noticed that these other classes were maintaining this number of terms on the side, so I refactored them to use PrefixCodedTerms.size() instead?