lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sören Pekrul <>
Subject Re: Words Frequency Problem
Date Fri, 18 Aug 2006 06:46:07 GMT
aslam bari wrote:
>   I am searching for a word "circle" in my indexed document list. It gives me total document
found 4 i.e. Hits. But now i want to get how many occurances are there in each document i.e.
frequency of words in result document.

Hello Aslam,

you should store the TermVector in the index as well:

doc.add(new Field("field name", "field value", Field.Store.YES, 
Field.Index.TOKENIZED, Field.TermVector.YES));

"A term vector is a list of the document's terms and their number of 
occurences in that document."

The IndexReader allows you to access the TermVector of a document:

TermFreqVector IndexReader.getTermFreqVector(int docNumber, String field)

I hope it helps.


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

View raw message