[ 
https://issues.apache.org/jira/browse/SOLR-17580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17904044#comment-17904044
 ] 

Artem Abeleshev commented on SOLR-17580:
----------------------------------------

I think I've missed an important detail about local parameters: they can be 
defined only once per query parameter, while I was trying to apply them 
multiple times. The query parser seems doesn't apply any query validation 
checks and was trying to parse it as it is and failed. Unfortunately, it 
doesn't provide any hints for that case.

After switching to follows everything starts to work as expected:
{code:java}
localhost:8983/solr/collection/select?fq={!tag=a}name:foo OR name:bar\(baz\) 
{code}
This way I'm tagging the whole query instead of each part of the query, that is 
aslo simplifies the usage of the *_ex_* local parameter later.

Sorry for rising an issue without investigating it more deeply...

 

 

> 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