[
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
mized with `tag` directives and escaping. Here is what I've got:
If you run queries below they are running successfully:
```
localhost:9432/solr/collection/select?fq=name:foo
localhost:9432/solr/collection/select?fq=name:bar\(baz\)
```
Also, if you combine them using `OR` query is also parsed and runned
successfully:
```
localhost:9432/solr/collection/select?fq=name:foo OR name:bar\(baz\)
```
Adding tags to the first two queries is also OK:
```
localhost:9432/solr/collection/select?fq=\{!tag=a}name:foo
localhost:9432/solr/collection/select?fq=\{!tag=b}name:bar\(baz\)
```
But combining them with `OR` failing:
```
localhost:9432/solr/collection/select?fq=\{!tag=a}name:foo OR
\{!tag=b}name:bar\(baz\)
```
sending back error response:
```json
{
"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
}
}
```
The same effect if using variables:
```
localhost:9432/solr/collection/select?fq=\{!tag=a}${a} OR
\{!tag=b}${b}&a=name:foo&b=name:bar(baz)
```
The funny thing is that if I change the order of the `OR` entries like this:
```
localhost:9432/solr/collection/select?fq=\{!tag=b}name:bar\(baz\) OR
\{!tag=a}name:foo
```
it worked OK
was:
It seems there are some problems with query lexical analyser parsing queries
mized with `tag` directives and escaping. Here is what I've got:
If you run queries below they are running successfully:
```
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=annkennsute_tasu:foo
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=annkennsute_tasu:bar\(baz\)
```
Also, if you combine them using `OR` query is also parsed and runned
successfully:
```
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=annkennsute_tasu:foo
OR annkennsute_tasu:bar\(baz\)
```
Adding tags to the first two queries is also OK:
```
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=\{!tag=a}annkennsute_tasu:foo
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=\{!tag=b}annkennsute_tasu:bar\(baz\)
```
But combining them with `OR` failing:
```
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=\{!tag=a}annkennsute_tasu:foo
OR \{!tag=b}annkennsute_tasu:bar\(baz\)
```
sending back error response:
```json
{
"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
}
}
```
The same effect if using variables:
```
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=\{!tag=a}${a}
OR \{!tag=b}${b}&a=annkennsute_tasu:foo&b=annkennsute_tasu:bar(baz)
```
The funny thing is that if I change the order of the `OR` entries like this:
```
https://byside-dev-solr.i.kandasearch.com/solr/transfer-deal/select?fq=\{!tag=b}annkennsute_tasu:bar\(baz\)
OR \{!tag=a}annkennsute_tasu:foo
```
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
> mized with `tag` directives and escaping. Here is what I've got:
> If you run queries below they are running successfully:
> ```
> localhost:9432/solr/collection/select?fq=name:foo
> localhost:9432/solr/collection/select?fq=name:bar\(baz\)
> ```
> Also, if you combine them using `OR` query is also parsed and runned
> successfully:
> ```
> localhost:9432/solr/collection/select?fq=name:foo OR name:bar\(baz\)
> ```
> Adding tags to the first two queries is also OK:
> ```
> localhost:9432/solr/collection/select?fq=\{!tag=a}name:foo
> localhost:9432/solr/collection/select?fq=\{!tag=b}name:bar\(baz\)
> ```
> But combining them with `OR` failing:
> ```
> localhost:9432/solr/collection/select?fq=\{!tag=a}name:foo OR
> \{!tag=b}name:bar\(baz\)
> ```
> sending back error response:
> ```json
> {
> "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
> }
> }
> ```
> The same effect if using variables:
> ```
> localhost:9432/solr/collection/select?fq=\{!tag=a}${a} OR
> \{!tag=b}${b}&a=name:foo&b=name:bar(baz)
> ```
> The funny thing is that if I change the order of the `OR` entries like this:
> ```
> localhost:9432/solr/collection/select?fq=\{!tag=b}name:bar\(baz\) OR
> \{!tag=a}name:foo
> ```
> it worked OK
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]