Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-9008

Surround Query Parser NOT operator is binary

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 8.3
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
    • Lucene Fields:
      New

      Description

      The following query works in the surround query parser (tested via solr):

      foo NOT bar

      However despite the Solr ref guide specifically noting that "NOT" is unary, the following throw parsing exceptions (also tested in solr):

      foo AND NOT bar
      NOT bar AND foo

      additionally the right hand side of NOT requires parenthesis for fielded terms...

      fizz NOT game:buzz 

      throws an exception whereas

      fizz NOT (game:buzz) 

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gus Gus Heck
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: