lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sören Pekrul <soeren.pek...@gmx.de>
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.

Sören

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message