lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samd <>
Subject Re: QueryParser returning TermQuery instead of PhraseQuery?
Date Tue, 21 Oct 2008 10:45:40 GMT

The Snowball Analyzer was chosen since there are cases where the stemming is
desired. This is one case where it is not although the same results are
produced with the Standard Analyzer. If this doesn't work I guess I'll
probably need to try to programmatically provide an additional field to the
search parameters in order to make the results unique.

Daniel Noll-3 wrote:
> 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
>                                and eDiscovery software
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

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

View raw message