From c8b4f6d47392e8a5c284ea2ed3ed7dde91557166 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 23 Apr 2012 00:50:34 +0000 Subject: [PATCH] move fill to TermStatsQueue (which was pkg-private, so the static method wasnt useful anyway) git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1329013 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/misc/HighFreqTerms.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lucene/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java b/lucene/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java index d92ad9ba162..52faf490ce7 100644 --- a/lucene/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java +++ b/lucene/misc/src/java/org/apache/lucene/misc/HighFreqTerms.java @@ -123,7 +123,7 @@ public class HighFreqTerms { if (terms != null) { TermsEnum termsEnum = terms.iterator(null); tiq = new TermStatsQueue(numTerms); - fillQueue(termsEnum, tiq, field); + tiq.fill(field, termsEnum); } } else { Fields fields = MultiFields.getFields(reader); @@ -137,7 +137,7 @@ public class HighFreqTerms { if (field != null) { Terms terms = fieldsEnum.terms(); if (terms != null) { - fillQueue(terms.iterator(null), tiq, field); + tiq.fill(field, terms.iterator(null)); } } else { break; @@ -211,18 +211,6 @@ public class HighFreqTerms { return totalTF[0]; } - - public static void fillQueue(TermsEnum termsEnum, TermStatsQueue tiq, String field) throws Exception { - - while (true) { - BytesRef term = termsEnum.next(); - if (term != null) { - tiq.insertWithOverflow(new TermStats(field, term, termsEnum.docFreq())); - } else { - break; - } - } - } } /** @@ -257,4 +245,15 @@ final class TermStatsQueue extends PriorityQueue { protected boolean lessThan(TermStats termInfoA, TermStats termInfoB) { return termInfoA.docFreq < termInfoB.docFreq; } + + protected void fill(String field, TermsEnum termsEnum) throws IOException { + while (true) { + BytesRef term = termsEnum.next(); + if (term != null) { + insertWithOverflow(new TermStats(field, term, termsEnum.docFreq())); + } else { + break; + } + } + } }