} finally {
Closeables.closeQuietly(writer);
}
IndexReader reader = IndexReader.open(directory, true);
Weight weight = new TFIDF();
TermInfo termInfo = new CachedTermInfo(reader, "content", 1, 100);
int numTerms = 0;
for (Iterator<TermEntry> it = termInfo.getAllEntries(); it.hasNext();) {
it.next();
numTerms++;
}
termDictionary = new String[numTerms];
int i = 0;
for (Iterator<TermEntry> it = termInfo.getAllEntries(); it.hasNext();) {
String term = it.next().getTerm();
termDictionary[i] = term;
System.out.println(i + " " + term);
i++;
}