en, I describe my question more clearly:

I search with a group of query terms, I can get a document from the search result:

Query(term1, term2, term3)-->search index-->Hits(doc1, doc2, doc3, ......)

I wanna get term1's frequency in doc1 ?

Hits(docs1((term1,freq),(term2,freq),(term3,freq)),
    docs2((term1,freq),(term2,freq),(term3,freq)),......)


I think the tf value is caculated in the index procedure. can I get the tf(term frequency) value of term1 directly?

I can do it in this way:


QueryTermVector vector= new QueryTermVector(Document.getValues(field));
freq = result.getTermFrequencies();


but I think this is a very low efficient way.

Anyone can help me ? thx


sog


----- Original Message ----- From: "Daniel Noll" <[EMAIL PROTECTED]>
To: <java-user@lucene.apache.org>
Sent: Wednesday, February 22, 2006 1:19 PM
Subject: Re: How can I get a term's frequency?


sog wrote:

I search the index with a group of terms. I want to get every term's frequency in each document of the search result.

Are you looking for this?

TermFreqVector vector = IndexReader.getTermFreqVector(docNum, "field");

That gives you the frequency of every term, but you can just look up the
ones you're interested in.

Daniel


--
Daniel Noll

Nuix Australia Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia
Phone: (02) 9280 0699
Fax:   (02) 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to