Thanks Ian.

I agree with you on lowercasing of characters. My main concern is specific to 
stemming done by analyzers.

For example, StandardAnalyzer will stem words like playing, played, plays, etc. 
to a common tokan "play" which will be stored in the index. Now, during 
searches, we would need same stemming to be performed on search tokens so that 
we can use equals searches and get correct results back. In this example, the 
search term "playing" or "plays" may not return the document as it is indexed 
with token "play".

What I am not really getting it how I can use the same analyzer during searches 
is I am constructing queries manually.

Regards,
Rajesh

--- On Tue, 1/13/09, Ian Lea <[email protected]> wrote:

> From: Ian Lea <[email protected]>
> Subject: Re: Using analyzer while constructing Lucene queries
> To: [email protected], [email protected]
> Date: Tuesday, January 13, 2009, 9:33 AM
> If you are building queries manually, bypassing analysis,
> you just
> need to make sure that you know what you are doing.  As a
> trivial
> example, if you are indexing with an analyzer that
> downcases
> everything then you need to pass lowercase terms to
> TermQuery.
> 
> You can still use an analyzer where appropriate e.g. to
> parse a string
> into a Query that you add to a BooleanQuery.
> 
> 
> --
> Ian.
> 
> 
> On Tue, Jan 13, 2009 at 1:43 AM, Rajesh parab
> <[email protected]> wrote:
> > Hi,
> >
> > For proper results during searches, the recommendation
> is to use same analyzer for indexing and querying. We can
> achieve this by passing the same analyzer, which was used
> for indexing, to QueryParser to construct Lucene query and
> use this query while searching the index.
> >
> > The question is - How can we use the analyzer that was
> used for indexing, if we want to construct Lucene queries
> manually using Query classes (like BooleanQuery, TermQuery,
> PhraseQuery, etc) instead of using QueryParser?
> >
> > Is there any way to achieve it?
> >
> > Regards,
> > Rajesh


      

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to