NOTE: if this would exceed the array size, this method creates a new reference array.
206207208209210211212213214215216
while (true) { BytesRef term = termsEnum.next(); if (term != null) { BytesRefBuilder r = new BytesRefBuilder(); r.copyBytes(term); tiq.insertWithOverflow(new TermStats(field, r.get(), termsEnum.docFreq())); } else { break; } }