lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <dan...@nuix.com>
Subject Re: QueryParser returning TermQuery instead of PhraseQuery?
Date Tue, 21 Oct 2008 05:45:30 GMT
samd wrote:
> I have field for example say "foo" I need to match exactly foo but there is
> also another field for exampled called "foo1"
> 
> What I want is a PhraseQuery so I surround foo with quotes before it gets
> passed to the QueryParser.parse method. However I get back a TermQuery and
> the values that match foo1 end up being returned in the results but I need
> an exact match on foo.

I'm not sure what you're trying to achieve, but:

    1. Merely putting quotes around something doesn't make it a
       PhraseQuery, having more than one term inside the quotes makes
       something a phrase query.

    2. Stop words sometimes removes a word such that what you thought
       was a two-term query is actually one.

    3. Whether it's a PhraseQuery or TermQuery has no effect on the way
       it matches each individual term, i.e. it won't be any more or less
       "exact".

> I don't want to have to have a special case for PhraseQuery where I need to
> bypass the parse method and manually construct this. Besides I'm not even
> sure if that will work.

Even if it does "work" it won't change the semantics.

This is sounding like an X-Y problem, so what are you actually trying to 
achieve?  It sounds like you don't want stemming (talking about "exact" 
matches) yet you chose the snowball analyser (whose sole purpose is 
stemming, unless I am mistaken...)

Daniel


-- 
Daniel Noll                            Forensic and eDiscovery Software
Senior Developer                              The world's most advanced
Nuix                                                email data analysis
http://nuix.com/                                and eDiscovery software

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


Mime
View raw message