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 Nissim Shiman <ns...@yahoo.com.INVALID> on 2020/11/05 20:07:13 UTC
BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at
least one BooleanClause.Occur.MUST
Hello Apache Lucene team members,
I have found that constructing a BooleanQuery with just a BooleanClause.Occur.MUST_NOT will return no results. It will return results is if there is also a BooleanClause.Occur.MUST as part of the query as well though.
I don't see this limitation with a BooleanQuery with just a BooleanClause.Occur.MUST (i.e. results will return fine if they match).
Is this by design or is this an issue?
Thanks You,
Nissim Shiman
Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at least one BooleanClause.Occur.MUST
Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,
Finally, to "fix" it so it behaves like you may want it: just add a MatchAllDocsQuery as MUST or SHOULD clause. You have full control on how it behaves!
Uwe
Am November 6, 2020 6:05:03 PM UTC schrieb Nissim Shiman <ns...@yahoo.com.INVALID>:
> Thank You Erick and Adrien!
>On Friday, November 6, 2020, 08:43:59 AM EST, Erick Erickson
><er...@gmail.com> wrote:
>
> Nissim:
>
>Here’s a good explanation of why it was designed this way
>if you’d like details:
>
>https://lucidworks.com/post/why-not-and-or-and-not/
>
>Don’t be put off by the Solr title, it’s really about
>BooleanQuery and BooleanClause
>
>Best,
>Erick
>
>> On Nov 6, 2020, at 8:17 AM, Adrien Grand <jp...@gmail.com> wrote:
>>
>> Hi Nissim,
>>
>> This is by design: boolean queries that don't have positive clauses
>like
>> empty boolean queries or boolean queries that only consist of
>negative
>> (MUST_NOT) clauses don't match any hits.
>>
>> On Thu, Nov 5, 2020 at 9:07 PM Nissim Shiman
><ns...@yahoo.com.invalid>
>> wrote:
>>
>>> Hello Apache Lucene team members,
>>> I have found that constructing a BooleanQuery with just
>>> a BooleanClause.Occur.MUST_NOT will return no results. It will
>return
>>> results is if there is also a BooleanClause.Occur.MUST as part of
>the query
>>> as well though.
>>>
>>>
>>> I don't see this limitation with a BooleanQuery with just
>>> a BooleanClause.Occur.MUST (i.e. results will return fine if they
>match).
>>>
>>> Is this by design or is this an issue?
>>>
>>> Thanks You,
>>> Nissim Shiman
>>
>>
>>
>> --
>> Adrien
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>
--
Uwe Schindler
Achterdiek 19, 28357 Bremen
https://www.thetaphi.de
Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at
least one BooleanClause.Occur.MUST
Posted by Nissim Shiman <ns...@yahoo.com.INVALID>.
Thank You Erick and Adrien!
On Friday, November 6, 2020, 08:43:59 AM EST, Erick Erickson <er...@gmail.com> wrote:
Nissim:
Here’s a good explanation of why it was designed this way
if you’d like details:
https://lucidworks.com/post/why-not-and-or-and-not/
Don’t be put off by the Solr title, it’s really about
BooleanQuery and BooleanClause
Best,
Erick
> On Nov 6, 2020, at 8:17 AM, Adrien Grand <jp...@gmail.com> wrote:
>
> Hi Nissim,
>
> This is by design: boolean queries that don't have positive clauses like
> empty boolean queries or boolean queries that only consist of negative
> (MUST_NOT) clauses don't match any hits.
>
> On Thu, Nov 5, 2020 at 9:07 PM Nissim Shiman <ns...@yahoo.com.invalid>
> wrote:
>
>> Hello Apache Lucene team members,
>> I have found that constructing a BooleanQuery with just
>> a BooleanClause.Occur.MUST_NOT will return no results. It will return
>> results is if there is also a BooleanClause.Occur.MUST as part of the query
>> as well though.
>>
>>
>> I don't see this limitation with a BooleanQuery with just
>> a BooleanClause.Occur.MUST (i.e. results will return fine if they match).
>>
>> Is this by design or is this an issue?
>>
>> Thanks You,
>> Nissim Shiman
>
>
>
> --
> Adrien
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at
least one BooleanClause.Occur.MUST
Posted by Erick Erickson <er...@gmail.com>.
Nissim:
Here’s a good explanation of why it was designed this way
if you’d like details:
https://lucidworks.com/post/why-not-and-or-and-not/
Don’t be put off by the Solr title, it’s really about
BooleanQuery and BooleanClause
Best,
Erick
> On Nov 6, 2020, at 8:17 AM, Adrien Grand <jp...@gmail.com> wrote:
>
> Hi Nissim,
>
> This is by design: boolean queries that don't have positive clauses like
> empty boolean queries or boolean queries that only consist of negative
> (MUST_NOT) clauses don't match any hits.
>
> On Thu, Nov 5, 2020 at 9:07 PM Nissim Shiman <ns...@yahoo.com.invalid>
> wrote:
>
>> Hello Apache Lucene team members,
>> I have found that constructing a BooleanQuery with just
>> a BooleanClause.Occur.MUST_NOT will return no results. It will return
>> results is if there is also a BooleanClause.Occur.MUST as part of the query
>> as well though.
>>
>>
>> I don't see this limitation with a BooleanQuery with just
>> a BooleanClause.Occur.MUST (i.e. results will return fine if they match).
>>
>> Is this by design or is this an issue?
>>
>> Thanks You,
>> Nissim Shiman
>
>
>
> --
> Adrien
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at
least one BooleanClause.Occur.MUST
Posted by Adrien Grand <jp...@gmail.com>.
Hi Nissim,
This is by design: boolean queries that don't have positive clauses like
empty boolean queries or boolean queries that only consist of negative
(MUST_NOT) clauses don't match any hits.
On Thu, Nov 5, 2020 at 9:07 PM Nissim Shiman <ns...@yahoo.com.invalid>
wrote:
> Hello Apache Lucene team members,
> I have found that constructing a BooleanQuery with just
> a BooleanClause.Occur.MUST_NOT will return no results. It will return
> results is if there is also a BooleanClause.Occur.MUST as part of the query
> as well though.
>
>
> I don't see this limitation with a BooleanQuery with just
> a BooleanClause.Occur.MUST (i.e. results will return fine if they match).
>
> Is this by design or is this an issue?
>
> Thanks You,
> Nissim Shiman
--
Adrien