text: public static void main(String[] args) throws Exception {String field = null;int numTerms = DEFAULT_NUMTERMS;if (args.length == 0 || args.length > 4) {usage();System.exit(1);}Directory dir = FSDirectory.open(Paths.get(args[0]));Comparator<TermStats> comparator = new DocFreqComparator();for (int i = 1; i < args.length; i++) {if (args[i].equals("-t")) {comparator = new TotalTermFreqComparator();}else{try {numTerms = Integer.parseInt(args[i]);} catch (NumberFormatException e) {field=args[i];}}}IndexReader reader = DirectoryReader.open(dir);TermStats[] terms = getHighFreqTerms(reader, numTerms, field, comparator);for (int i = 0; i < terms.length; i++) {System.out.printf(Locale.ROOT, "%s:%s \t totalTF = %,d \t docFreq = %,d \n",terms[i].field, terms[i].termtext.utf8ToString(), terms[i].totalTermFreq, terms[i].docFreq);}reader.close();}