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

Classic, flexible, and Solr's standard/"lucene" query parsers: range queries should require " TO ", and accept TO as range endpoints

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6, 6.7, 7.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      A post on the solr-user mailing list drew my attention to the fact that this is apparently a valid range query under the QueryParser.jj grammer (both for the classic parser and the solr variant – i didn't check flexible)...

      [x z]       // parsed the same as [x TO z]
      

      it's parsed as a valid range query even though there is no {{ TO }} – even though there is nothing in the docs to suggest that the {{ TO }} is intended to be optional.

      Furthermore, in my experimenting i realized that how the grammer looks for the {{ TO }} keyword seems to be a bit sloppy, making some range queries that should be easy to validate (because they are unambiguous) fail to parse...

      [TO TO z]     // fails
      [a TO TO]     // fails
      [a TO "TO"]   // works, but why should quoting be neccessary here?
      

      If the "sloppy" parsing behavior is intentional, then the docs should reflect that the {{ TO }} is optional – but it seems like in general we should make these other unambiguous cases parse cleanly.

        Attachments

        1. LUCENE-7821.patch
          2 kB
          Hoss Man
        2. LUCENE-7821.patch
          30 kB
          Steve Rowe

          Activity

            People

            • Assignee:
              steve_rowe Steve Rowe
              Reporter:
              hossman Hoss Man
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: