Solr
  1. Solr
  2. SOLR-4121

balanced single quotes cause parse error in (new) standard QParser

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1, 5.0
    • Component/s: query parsers
    • Labels:
      None

      Description

      The parser changes introduced in SOLR-4093 cause the standard parser to freak out anytime there are blanaced single quotes in a query string.

      the expected behavior is that single quotes should not be considered special to the parser, and should be ignored and passed down to the appropriate field analyzers

      Example of error...
      http://localhost:8983/solr/select?q=%27zz+xx%27&debugQuery=true

      Caused by: org.apache.solr.parser.ParseException: Encountered " <SQUOTED> "\'zz xx\' "" at line 1, column 0.
      Was expecting one of:
          <NOT> ...
          "+" ...
          "-" ...
          <BAREOPER> ...
          "(" ...
          "*" ...
          <QUOTED> ...
          <TERM> ...
          <PREFIXTERM> ...
          <WILDTERM> ...
          <REGEXPTERM> ...
          "[" ...
          "{" ...
          <LPARAMS> ...
          <NUMBER> ...
          <TERM> ...
          "*" ...
          
      	at org.apache.solr.parser.QueryParser.generateParseException(QueryParser.java:649)
      	at org.apache.solr.parser.QueryParser.jj_consume_token(QueryParser.java:531)
      	at org.apache.solr.parser.QueryParser.Clause(QueryParser.java:216)
      	at org.apache.solr.parser.QueryParser.Query(QueryParser.java:107)
      	at org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:96)
      	at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:159)
      

        Issue Links

          Activity

          Hide
          Commit Tag Bot added a comment -

          [trunk commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1414929

          SOLR-4121: fix single quoted token issue with solr qparser

          Show
          Commit Tag Bot added a comment - [trunk commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1414929 SOLR-4121 : fix single quoted token issue with solr qparser
          Hide
          Yonik Seeley added a comment -

          Committed quick fix that seems to work, and I see that Mark's commit tracker picked it up, yay!
          I'll leave this open for now, and get around to finishing things up (more tests) before 4.1

          Show
          Yonik Seeley added a comment - Committed quick fix that seems to work, and I see that Mark's commit tracker picked it up, yay! I'll leave this open for now, and get around to finishing things up (more tests) before 4.1
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1414938

          SOLR-4121: fix single quoted token issue with solr qparser

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1414938 SOLR-4121 : fix single quoted token issue with solr qparser
          Hide
          Shawn Heisey added a comment -

          I tried to make a very simple test for this, added to TestSolrQueryParser.java, but it did not fail with the expected SyntaxError exception when tested on branch_4x revision 1414937. I'm probably making a very basic error.

            @Test
            public void testSolr4121() throws Exception {
              // This query doesn't match anything, testing
              // to make sure that SOLR-4121 is not a problem.
              req("q","id:'balance'");
            }
          
          Show
          Shawn Heisey added a comment - I tried to make a very simple test for this, added to TestSolrQueryParser.java, but it did not fail with the expected SyntaxError exception when tested on branch_4x revision 1414937. I'm probably making a very basic error. @Test public void testSolr4121() throws Exception { // This query doesn't match anything, testing // to make sure that SOLR-4121 is not a problem. req("q","id:'balance'"); }
          Hide
          Shawn Heisey added a comment -

          Success! The attached test patch fails properly on the old branch_4x revision and passes on the newest revision. Also applies cleanly and passes on trunk.

          Show
          Shawn Heisey added a comment - Success! The attached test patch fails properly on the old branch_4x revision and passes on the newest revision. Also applies cleanly and passes on trunk.
          Hide
          Yonik Seeley added a comment -

          Committed. Thanks for test!

          Show
          Yonik Seeley added a comment - Committed. Thanks for test!
          Hide
          Shawn Heisey added a comment -

          I was looking at the commit and realized the comment that I put in the test is no longer correct and needs to be removed. The test is fine.

          Show
          Shawn Heisey added a comment - I was looking at the commit and realized the comment that I put in the test is no longer correct and needs to be removed. The test is fine.
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1429189

          SOLR-4121: add test for fix

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1429189 SOLR-4121 : add test for fix
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1429183

          SOLR-4121: add test for fix

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1429183 SOLR-4121 : add test for fix
          Hide
          Commit Tag Bot added a comment -

          [trunk commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1429188

          SOLR-4121: add test for fix

          Show
          Commit Tag Bot added a comment - [trunk commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1429188 SOLR-4121 : add test for fix
          Hide
          Commit Tag Bot added a comment -

          [trunk commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1429181

          SOLR-4121: add test for fix

          Show
          Commit Tag Bot added a comment - [trunk commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1429181 SOLR-4121 : add test for fix
          Hide
          Commit Tag Bot added a comment -

          [branch_4x commit] Yonik Seeley
          http://svn.apache.org/viewvc?view=revision&revision=1414938

          SOLR-4121: fix single quoted token issue with solr qparser

          Show
          Commit Tag Bot added a comment - [branch_4x commit] Yonik Seeley http://svn.apache.org/viewvc?view=revision&revision=1414938 SOLR-4121 : fix single quoted token issue with solr qparser

            People

            • Assignee:
              Yonik Seeley
              Reporter:
              Hoss Man
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development