throws IOException {
Long2LongRBTreeMap relFreq = new Long2LongRBTreeMap();
relFreq.defaultReturnValue(0);
for (int i = 0; i < min(k, results.size()); i++) {
Document document = collection
.document(results.get(i).document);
Reader reader = (Reader) document.content(fieldIndex);
WordReader wordReader = document.wordReader(fieldIndex);
wordReader.setReader(reader);
MutableString word = new MutableString();
MutableString nonWord = new MutableString();
final LongRBTreeSet set = new LongRBTreeSet();
while (wordReader.next(word, nonWord)) {
if (processor.processTerm(word)) {
long termId = index.getTermId(word);
if (termId >= 0)
if (set.add(termId))
relFreq
.put(termId,
relFreq.get(termId) + 1);
}
}
document.close();
}
return relFreq;
}