java-user@lucene.apache.org
[Top] [All Lists]

QueryParser returning TermQuery instead of PhraseQuery?

Subject: QueryParser returning TermQuery instead of PhraseQuery?
From: samd
Date: Mon, 20 Oct 2008 19:31:14 -0700 PDT
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.


-- 
View this message in context: 
http://www.nabble.com/QueryParser-returning-TermQuery-instead-of-PhraseQuery--tp20082388p20082388.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: java-user-help@xxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>