You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sachin Kulkarni <ku...@hawk.iit.edu> on 2016/03/31 22:07:24 UTC

What is the difference between PhraseQuery and BooleanQuery with BooleanClause.Occur.SHOULD

Hi,

I am using Lucene-5.0.0.
If I had a qurey "New York" and if I use the BooleanQuery with the
BooleanClause set to MUST on the two terms, is it the same as dong a
PhraseQuery with the two terms?

I am doing some 2-gram type queries and they are giving me different
results with these two methods. I am trying to understand why is the
difference.

Thank you.

Regards,
Sachin

Re: What is the difference between PhraseQuery and BooleanQuery with BooleanClause.Occur.SHOULD

Posted by Sachin Kulkarni <ku...@hawk.iit.edu>.
I got the answer.
Somehow I missed it.
The PhraseQuery requires the terms to be in a fixed order whereas the
BooleanQuery does not require the terms to be
in a particular order.

On Thu, Mar 31, 2016 at 3:07 PM, Sachin Kulkarni <ku...@hawk.iit.edu>
wrote:

> Hi,
>
> I am using Lucene-5.0.0.
> If I had a qurey "New York" and if I use the BooleanQuery with the
> BooleanClause set to MUST on the two terms, is it the same as dong a
> PhraseQuery with the two terms?
>
> I am doing some 2-gram type queries and they are giving me different
> results with these two methods. I am trying to understand why is the
> difference.
>
> Thank you.
>
> Regards,
> Sachin
>