Hi, Thanks for suggesting local parameters. Unfortunately I can't refactor the codebase to make use of them because these queries are placed in fq statements that are treated as individual units by the UI. It would require massive refactoring and higher complexity as a consequence. The graph traversal is one of the possible fq statements but I am reproducing with {!boost ...} because it is much simpler and possible to demonstrate with the SolR demo dataset.
I forgot to mention that I am reproducing with the SolR demo dataset, e.g.: docker run --name solr_demo -d -p 8983:8983 solr solr-demo I have improved the sample queries to more clearly indicate that this is likely a bug, see below. The debugQuery=true does not really help much since the failure is earlier in the process. Fails: curl 'http://localhost:8983/solr/demo/select?q=inStock:true+AND+%7B%21boost+b%3Dmanufacturedate_dt%7Dfeatures%3A%22%28hello%20with%20an%20accent%20over%20the%20e%29%22&rows=5&debugQuery=true' Works: curl 'http://localhost:8983/solr/demo/select?q=%7B%21boost+b%3Dmanufacturedate_dt%7Dfeatures%3A%22%28hello%20with%20an%20accent%20over%20the%20e%29%22+AND+inStock:true&rows=5&debugQuery=false' NOTE: The only difference is moving the inStock:true part of the query to the end. Should be equivalent. Cannot enable debugQuery because it fails with: "msg":"java.lang.IllegalAccessException: access violation: class org.apache.solr.schema.DatePointField$DatePointFieldSource, from public Lookup", Thanks, Thomas Å. > On 14 Sep 2024, at 22:07, Mikhail Khludnev <m...@apache.org> wrote: > > Hello Thomas. > I think extensive use of local parameters references is easy than fighting > with escaping > q=inStock:true AND {!boost b=manufacturedate_dt v=$nameq}&nameq={!field > f=name}the (concept).xml > or even ...{!field f=name v=$nameval}&nameval=the (concept).xml > also depending on the field type you'd better use {!term}. > To continue post debugQuery=true output, when your query is parsed but > misbehave. > > On Sat, Sep 14, 2024 at 11:57 AM Thomas Åkesson <thomas.akes...@fastmail.se> > wrote: > >> Hi, >> We have come across a potentially incorrect lexical error with the >> following combination in the query: >> - Parentheses in the search term (tried both escaping and quoting) >> - Query parser within {}. Actual use-case is using !graph but clearer >> reproduction with something simple like !boost. >> - Using AND before the {!something ...} query. >> >> This query fails: >> curl ' >> http://localhost:8983/solr/demo/select?q=inStock:true+AND+%7B%21boost+b%3Dmanufacturedate_dt%7Dname%3Athe%2520%5C%28concept%5C%29.xml >> ' >> { >> "responseHeader":{ >> "status":400, >> "QTime":1, >> "params":{ >> "q":"inStock:true AND {!boost >> b=manufacturedate_dt}name:the%20\\(concept\\).xml" >> } >> }, >> "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:the%20\\(concept\\': Lexical error at line 1, column 22. >> Encountered: <EOF> (in lexical state 3)", >> "code":400 >> } >> >> >> Fails when quoted (no escaping needed?): >> curl ' >> http://localhost:8983/solr/demo/select?q=inStock:true+AND+%7B%21boost+b%3Dmanufacturedate_dt%7Dname%3A%22the%2520%28concept%29.xml%22 >> ' >> { >> "responseHeader":{ >> "status":400, >> "QTime":1, >> "params":{ >> "q":"inStock:true AND {!boost >> b=manufacturedate_dt}name:\"the%20(concept).xml\"" >> } >> }, >> "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:\"the%20(concept': Lexical error at line 1, column 21. Encountered: >> <EOF> after prefix \"\\\"the%20(concept\" (in lexical state 3)", >> "code":400 >> } >> >> Removing the closing parenthesis works: >> curl ' >> http://localhost:8983/solr/demo/select?q=inStock:true+AND+%7B%21boost+b%3Dmanufacturedate_dt%7Dname%3Athe%2520%5C%28concept.xml >> ' >> >> Removing the statement before works: >> curl ' >> http://localhost:8983/solr/demo/select?q=%7B%21boost+b%3Dmanufacturedate_dt%7Dname%3Athe%2520%5C%28concept%5C%29.xml >> ' >> >> >> Has anyone seen this issue before? Tested with 8.3 and 9.6.1. >> >> Thanks in advance, >> Thomas Å. >> >> >> >> >> >> >> >> >> > > -- > Sincerely yours > Mikhail Khludnev