You can do this a couple of different ways (at least):
1. Use term vectors. See http://www.cnlp.org/apachecon2005 for an
intro, search on this list, or look in Erik and Otis book Lucene In
Action. This will be the fastest way, but will require more space in
your index to store the term vector
Hi,
I want to get the freq of a term in a Doc.
public int termFreq( int docID, String termName ) {
IndexReader reader = IndexReader.open(directory);
Document doc = reader.document(docID);
int FreqForTerm = doc ???
return FreqForTerm;
}
I didn't find what I want in the archives.