LogInit.init();
logger.info("Threshold is 200" );
Integer threshold = new Integer( 200 );
IndexReader reader = IndexReader.open( "index" );
TermEnum enum = reader.terms();
List termList = new ArrayList();
while( enum.next() ) {
if( enum.docFreq() >= threshold.intValue() &&
enum.term().field().equals( "speech" ) ) {
Freq freq = new Freq( enum.term().text(), enum.docFreq() );
termList.add( freq );
}
}
Collections.sort( termList );
Collections.reverse( termList );
System.out.println( "Frequency | Term" );
Iterator iterator = termList.iterator();
while( iterator.hasNext() ) {
Freq freq = (Freq) iterator.next();
System.out.print( freq.frequency );
System.out.println( " | " + freq.term );
}