You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Satuluri, Venu_Madhav" <Ve...@deshaw.com> on 2006/05/18 14:08:15 UTC

How to do analysis when creating a query programmatically?

Hi all,

I have recently shifted to creating queries programmatically rather than
using the QueryParser as this gave me more flexibility. I am facing a
new problem, though: when indexing my fields are being analyzed (on a
per-field basis: most are being stemmed etc, some are keywords returned
as it is), but the query doesn't get analyzed as I construct it myself.
This means that many legitimate documents don't come up as results. 

Is there any way to run my Query object through my analyzer? Or is there
another solution?

Thanks in advance,
Venu



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


Re: How to do analysis when creating a query programmatically?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On May 18, 2006, at 8:08 AM, Satuluri, Venu_Madhav wrote:
> Is there any way to run my Query object through my analyzer? Or is  
> there
> another solution?

But of course.  Have a look at the source code to  
QueryParser.getFieldQuery() - it does this very thing.  I'm glad to  
see more folks creating queries programatically using a blend of  
QueryParser, analysis, or just plain ol' StringTokenizer.  The  
expressiveness of queries is of the utmost importance, and  
QueryParser is pretty BASIC.  Most of the applications I've worked on  
have used custom techniques for creating the Query.

	Erik


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