lucene-java-user mailing list archives

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

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

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.


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