TermFreqQueue tiq = new TermFreqQueue(count);
TermEnum terms = reader.terms();
int minFreq = 0;
while (terms.next()) {
if (terms.docFreq() > minFreq) {
TermFreq top = tiq.add(new TermFreq(terms.term(), terms.docFreq()));
if (tiq.size() >= count) { // if tiq overfull
tiq.pop(); // remove lowest in tiq
minFreq = top.docFreq; // reset minFreq
}