lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <>
Subject Re: how to use Field.TermVector
Date Fri, 02 Nov 2007 12:35:51 GMT

On Nov 2, 2007, at 4:37 AM, Jamal H Tandina wrote:

> Hi
> Iam having problem using Field.TermVector, i dont know how to use  
> it. does some one have an exemple or an address, how to use the  
> termVector in indexing an searching?

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

You don't really need to use it during searching necessarily, but it  
can come in handy for highlighting and other purposes (clustering,  
relevance feedback, etc.)

On the reader side,
IndexReader.getTermFreqVector(int, String)

let's you retrieve them from disk.

Also, see my talk from ApacheCon 2005 at 
apachecon2005/ as there are a number of examples there (although I  
don't guarantee they compile against the latest version of Lucene,  
they should still be generally applicable)

> doc.add(new Field("title", httpd.getTiltle(), Field.Store.YES,   
> Field.TermVector));
> Thanks
> ---------------------------------
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers  
> Yahoo! Mail

Grant Ingersoll

Lucene Boot Camp Training:
ApacheCon Atlanta, Nov. 12, 2007.  Sign up now!

Lucene Helpful Hints:

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

View raw message