LUCENE-3807: consume all terms from the enum

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1291506 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2012-02-20 22:53:55 +00:00
parent 9d210b0c37
commit 70501dd845
1 changed files with 7 additions and 5 deletions

View File

@ -91,11 +91,13 @@ public class HighFrequencyDictionary implements Dictionary {
@Override @Override
public BytesRef next() throws IOException { public BytesRef next() throws IOException {
if (termsEnum != null) { if (termsEnum != null) {
BytesRef next = termsEnum.next(); BytesRef next;
if (next != null && isFrequent(termsEnum.docFreq())) { while ((next = termsEnum.next()) != null) {
spare.copyBytes(next); if (isFrequent(termsEnum.docFreq())) {
return spare; spare.copyBytes(next);
} return spare;
}
}
} }
return null; return null;
} }