Gus Heck created LUCENE-9008:
--------------------------------

             Summary: Surround Query Parser NOT operator is binary (sort of)
                 Key: LUCENE-9008
                 URL: https://issues.apache.org/jira/browse/LUCENE-9008
             Project: Lucene - Core
          Issue Type: Bug
          Components: core/queryparser
    Affects Versions: 8.3
            Reporter: Gus Heck


The following query works in the surround query parser (tested via solr):
{code:java}
foo NOT bar{code}
However despite the Solr ref guide specifically noting that "NOT" is unary, the 
following throw parsing exceptions (also tested in solr):
{code:java}
foo AND NOT bar{code}
{code:java}
NOT bar AND foo{code}
additionally the right hand side of NOT requires parenthesis for fielded 
terms...
{code:java}
fizz NOT game:buzz {code}
throws an exception whereas
{code:java}
fizz NOT (game:buzz) {code}
keeps the parser happy.

The binary syntax may be intentional and certainly has a nice readability. The 
parenthesis around fielded stuff seems arbitrary and just irritating. However, 
this parser has been around for a long time so we probably won't want to go 
changing it fundamentally.

I suggest that this ticket should provide some docs clarifying at least this 
surprising syntax in the lucene package javadoc, the solr parser factory class 
javadocs and the solr ref guide docs 
([https://lucene.apache.org/solr/guide/8_1/other-parsers.html]) should be 
corrected and expanded to at least clarify this surprising and quirky binary 
NOT syntax.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to