Artem Abeleshev created SOLR-17580:
--------------------------------------

             Summary: 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


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

 



--
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