if you ask performance-wise, either way we're screwed in this block :)
it's allocating something large (list or array) for each invocation of collect; it would be great to do something about it but as you say in the PR comment that's definitely something that can happen at a second time.

I'm more concerned on the actual size returned by `getValueCount()`: as you say the javadoc is very limited, but to me it looks like it's not the _max number of values in any document_ but rather the _count of all unique terms across all documents_ , so this could be billions even if each document had just a couple of different terms.