lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <>
Subject Re: How can I get a term's frequency?
Date Thu, 23 Feb 2006 13:33:57 GMT
You need to make sure you are indexing with Term Vectors in order for
IndexReader.getTermFreqVector to return anything meaningful. You do not
need to implement it.

QueryTermVector is meant to provide similar information to the Document
side for Queries.

For an example demo of indexing and using term vectors, go to All the examples are under Apache
license and there is some documentation too.


Daniel Noll wrote:
> sog wrote:
>> en, but IndexReader.getTermFreqVector is an abstract method, I do not 
>> know how to implement it in an efficient way. Anyone has good advise?
> You probably don't need to implement it, it's been implemented already.
>  Just call the method.
>> I can do it in this way:
>> QueryTermVector vector= new QueryTermVector(Document.getValues(field));
>> freq = result.getTermFrequencies();
> I'm not sure because I've never used QueryTermVector before, but the
> fact that QueryTermVector doesn't take an IndexReader as a parameter is
> a good indication that it can't tell you anything about the frequency of
> the term in your documents.
> Daniel

Grant Ingersoll 
Sr. Software Engineer 
Center for Natural Language Processing 
Syracuse University 
School of Information Studies 
335 Hinds Hall 
Syracuse, NY 13244 
Voice:  315-443-5484 
Fax: 315-443-6886 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message