[ 
https://issues.apache.org/jira/browse/SOLR-17580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Artem Abeleshev updated SOLR-17580:
-----------------------------------
    Description: 
It seems there are some problems with query lexical analyser parsing queries 
mixed with *_tag_* directives and {*}_escaping_{*}. Here is what I've got:

If you run queries below they are running successfully:
{code:java}
localhost:8983/solr/collection/select?fq=name:foo
localhost:8983/solr/collection/select?fq=name:bar\(baz\)
{code}
Also, if you combine them using *_OR_* the query is also parsed and runned 
successfully:
{code:java}
localhost:8983/solr/collection/select?fq=name:foo OR name:bar\(baz\) {code}
Adding tags to the first two queries is also OK:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}name:foo
localhost:8983/solr/collection/select?fq={!tag=b}name:bar\(baz\) {code}
But combining them with *_OR_* is failing:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}name:foo OR 
{!tag=b}name:bar\(baz\) {code}
sending back error response:
{code:java}
{
  "responseHeader":{
    "status":400,
    "QTime":0,
    "params":{
      "fq":"{!tag=a}name:foo OR {!tag=b}name:bar\\(baz\\)"
    }
  },
  "error":{
    
"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.parser.TokenMgrError"],
    "msg":"org.apache.solr.search.SyntaxError: Cannot parse 'name:bar\\(baz\\': 
Lexical error at line 1, column 16.  Encountered: <EOF> (in lexical state 3)",
    "code":400
  }
} {code}
Removing the _*tag*_ directive makes above query working OK. The same effect 
when using variables:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}${a} OR 
{!tag=b}${b}&a=name:foo&b=name:bar(baz) {code}
The funny thing is that if I change the order of the _*OR*_ entries like this:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=b}name:bar\(baz\) OR 
{!tag=a}name:foo {code}
it worked OK

 

  was:
It seems there are some problems with query lexical analyser parsing queries 
mixed with *_tag_* directives and {*}_escaping_{*}. Here is what I've got:

If you run queries below they are running successfully:
{code:java}
localhost:8983/solr/collection/select?fq=name:foo
localhost:8983/solr/collection/select?fq=name:bar\(baz\)
{code}
Also, if you combine them using *_OR_* the query is also parsed and runned 
successfully:
{code:java}
localhost:8983/solr/collection/select?fq=name:foo OR name:bar\(baz\) {code}
Adding tags to the first two queries is also OK:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}name:foo
localhost:8983/solr/collection/select?fq={!tag=b}name:bar\(baz\) {code}
But combining them with *_OR_* is failing:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}name:foo OR 
{!tag=b}name:bar\(baz\) {code}
sending back error response:
{code:java}
{
  "responseHeader":{
    "status":400,
    "QTime":0,
    "params":{
      "fq":"{!tag=a}name:foo OR {!tag=b}name:bar\\(baz\\)"
    }
  },
  "error":{
    
"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.parser.TokenMgrError"],
    "msg":"org.apache.solr.search.SyntaxError: Cannot parse 'name:bar\\(baz\\': 
Lexical error at line 1, column 16.  Encountered: <EOF> (in lexical state 3)",
    "code":400
  }
} {code}
The same effect when using variables:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}${a} OR 
{!tag=b}${b}&a=name:foo&b=name:bar(baz) {code}
Removing the _*tag*_ directive makes above query working OK. The funny thing is 
that if I change the order of the _*OR*_ entries like this:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=b}name:bar\(baz\) OR 
{!tag=a}name:foo {code}
it worked OK

 


> Query parser problems when using tags and escaping
> --------------------------------------------------
>
>                 Key: SOLR-17580
>                 URL: https://issues.apache.org/jira/browse/SOLR-17580
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query parsers
>    Affects Versions: 9.6.1
>            Reporter: Artem Abeleshev
>            Priority: Major
>              Labels: parser
>
> It seems there are some problems with query lexical analyser parsing queries 
> mixed with *_tag_* directives and {*}_escaping_{*}. Here is what I've got:
> If you run queries below they are running successfully:
> {code:java}
> localhost:8983/solr/collection/select?fq=name:foo
> localhost:8983/solr/collection/select?fq=name:bar\(baz\)
> {code}
> Also, if you combine them using *_OR_* the query is also parsed and runned 
> successfully:
> {code:java}
> localhost:8983/solr/collection/select?fq=name:foo OR name:bar\(baz\) {code}
> Adding tags to the first two queries is also OK:
> {code:java}
> localhost:8983/solr/collection/select?fq={!tag=a}name:foo
> localhost:8983/solr/collection/select?fq={!tag=b}name:bar\(baz\) {code}
> But combining them with *_OR_* is failing:
> {code:java}
> localhost:8983/solr/collection/select?fq={!tag=a}name:foo OR 
> {!tag=b}name:bar\(baz\) {code}
> sending back error response:
> {code:java}
> {
>   "responseHeader":{
>     "status":400,
>     "QTime":0,
>     "params":{
>       "fq":"{!tag=a}name:foo OR {!tag=b}name:bar\\(baz\\)"
>     }
>   },
>   "error":{
>     
> "metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.parser.TokenMgrError"],
>     "msg":"org.apache.solr.search.SyntaxError: Cannot parse 
> 'name:bar\\(baz\\': Lexical error at line 1, column 16.  Encountered: <EOF> 
> (in lexical state 3)",
>     "code":400
>   }
> } {code}
> Removing the _*tag*_ directive makes above query working OK. The same effect 
> when using variables:
> {code:java}
> localhost:8983/solr/collection/select?fq={!tag=a}${a} OR 
> {!tag=b}${b}&a=name:foo&b=name:bar(baz) {code}
> The funny thing is that if I change the order of the _*OR*_ entries like this:
> {code:java}
> localhost:8983/solr/collection/select?fq={!tag=b}name:bar\(baz\) OR 
> {!tag=a}name:foo {code}
> it worked OK
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to