In HotelDatabase project of lucene, Following code is written in performSearch 
method of SearchEngine class.

Let queryString = "Located in the heart of paris"

Analyzer analyzer = new StandardAnalyzer();
IndexSearcher is = new IndexSearcher("index");
QueryParser parser = new QueryParser("content", analyzer);
Query query = parser.parse(queryString);
Hits hits = is.search(query);

To be specific what i want here
i) Removing stop words from query string and use stemming, so new query string 
should become "Locate heart paris"
ii) How to get term frequency (tf) of each word in query?
iii) How to get Document Frequency(df) of each word in query?
iv) How to get Inverse Document Frequency (idf) of each word in query?


Can u please let me know some solution that give answer of all my four 
questions. Or can you refer me to some sample code.  I have tried boolean query 
but unable to do this.




> From: thienthanhom...@gmail.com
> Date: Wed, 3 Feb 2010 04:59:49 +0900
> Subject: Re: Getting DF & IDF
> To: java-user@lucene.apache.org
> 
> with my idea,
> using BooleanQuery, you can make every thing.
> 
> 
> On Mon, Feb 1, 2010 at 10:44 PM, Asif Nawaz <asifna...@hotmail.com> wrote:
> 
> >
> > Hi, I am new to use lucene, I have a query string of multiple terms. i) i
> > want to return query string by removing stop words and stemmed version of
> > the query.
> > ii) second i want to get tf and idf of each term in a query, how to get it?
> >
> >
> >
> >
> >
> >
> >
> > Asif
> >
> >
> > _________________________________________________________________
> > Hotmail: Trusted email with powerful SPAM protection.
> > https://signup.live.com/signup.aspx?id=60969
> >
                                          
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969

Reply via email to