Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at least one BooleanClause.Occur.MUST

2020-11-06 Thread Uwe Schindler
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 
:
> Thank You Erick and Adrien!
>On Friday, November 6, 2020, 08:43:59 AM EST, Erick Erickson
> 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  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
>
>> 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-unsubscr...@lucene.apache.org
>For additional commands, e-mail: java-user-h...@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

2020-11-06 Thread Nissim Shiman
 Thank You Erick and Adrien!
On Friday, November 6, 2020, 08:43:59 AM EST, Erick Erickson 
 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  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 
> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org
  

Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at least one BooleanClause.Occur.MUST

2020-11-06 Thread Erick Erickson
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  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 
> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



Re: BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at least one BooleanClause.Occur.MUST

2020-11-06 Thread Adrien Grand
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 
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


BooleanQuery: BooleanClause.Occur.MUST_NOT seems to require at least one BooleanClause.Occur.MUST

2020-11-05 Thread Nissim Shiman
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