The Terms instance from IndexReader.getTermVector
acts as if you have a single-document index, comprised entirely of the document specified. Since there is only one document to consider in this context, you should always get docfreq()
= 1. You could generate the docfreq from the full index using the IndexReader.docFreq
method:
int docNumbersWithTerm = reader.docFreq(new Term(termsEnum.term(), field));
System.out.println(docNumbersWithTerm);