[ 
https://issues.apache.org/jira/browse/LUCENE-3451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14051934#comment-14051934
 ] 

Jack Krupansky commented on LUCENE-3451:
----------------------------------------

[~yo...@apache.org] says:

bq. The current handling of boolean queries with only prohibited clauses is not 
a bug, but working as designed, so this issue is about changing that behavior. 
Currently working applications will now start unexpectedly throwing 
exceptions... now that's trappy.

The fact that a pure negative query, actually a sub-query within parentheses in 
the query parser, returns zero documents has been a MAJOR problem for Solr 
users. I've lost count how many times it has come up on the user list and we 
tell users to work around the problem by manually inserting "\*:\*" after the 
left parenthesis.

But I am interested in hearing why it is believed that it is "working as 
designed" and whether there are really applications that would intentionally 
write a list of negative clauses when the "design" is that they will simply be 
ignored and match no documents. If that kind of compatibility is really needed, 
I would say it can be accommodated with a config setting, rather than give 
unexpected and bad behavior for so many other people with the current behavior.

I would prefer to see a "fix" the problem by having BQ do the right thing by 
implicitly starting with a MatchAllDocsQuery if only MUST_NOT clauses are 
present, but... if that is not possible, an exception would be much better.

Alternatively, given the difficulty of doing almost anything with the various 
query parsers, the method that generates the BQ for the query parser 
(QueryParserBase .getBooleanQuery) should just check for pure negative clauses 
and then add the MADQ. If this is massively controversial, just add a config 
option to disable it.


> Remove special handling of pure negative Filters in BooleanFilter, disallow 
> pure negative queries in BooleanQuery
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3451
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3451
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.9, 5.0
>
>         Attachments: LUCENE-3451.patch, LUCENE-3451.patch, LUCENE-3451.patch, 
> LUCENE-3451.patch, LUCENE-3451.patch
>
>
> We should at least in Lucene 4.0 remove the hack in BooleanFilter that allows 
> pure negative Filter clauses. This is not supported by BooleanQuery and 
> confuses users (I think that's the problem in LUCENE-3450).
> The hack is buggy, as it does not respect deleted documents and returns them 
> in its DocIdSet.
> Also we should think about disallowing pure-negative Queries at all and throw 
> UOE.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to