Java Mailing List Archive

http://www.java2.5341.com/

Home » java-user.lucene »

QueryParser returning TermQuery instead of PhraseQuery?

samd

2008-10-20

Replies: Find Java Web Hosting

Author LoginPost Reply

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.

Why am I getting back a Term instead of Phrase query? I'm using the English
SnowballAnalyzer.

What can I do to get the PhraseQuery? I'm relying on the parse method to
return the appropriate query. And I'm doing the string manipulation prior to
the parse call.

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.

Thanks.


--
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@(protected)
For additional commands, e-mail: java-user-help@(protected)

©2008 java2.5341.com - Jax Systems, LLC, U.S.A.