From 70501dd8457adf04bf5caeee2c7c27f5354db4a4 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 20 Feb 2012 22:53:55 +0000 Subject: [PATCH] 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 --- .../lucene/search/spell/HighFrequencyDictionary.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java b/modules/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java index bec1c3159b2..6ac023089f5 100644 --- a/modules/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java +++ b/modules/suggest/src/java/org/apache/lucene/search/spell/HighFrequencyDictionary.java @@ -91,11 +91,13 @@ public class HighFrequencyDictionary implements Dictionary { @Override public BytesRef next() throws IOException { if (termsEnum != null) { - BytesRef next = termsEnum.next(); - if (next != null && isFrequent(termsEnum.docFreq())) { - spare.copyBytes(next); - return spare; - } + BytesRef next; + while ((next = termsEnum.next()) != null) { + if (isFrequent(termsEnum.docFreq())) { + spare.copyBytes(next); + return spare; + } + } } return null; }