SSHOC / sshoc-marketplace-backend

Code for the backend
Apache License 2.0
2 stars 0 forks source link

don't crash on empty dynamic-property queries #158

Closed dpancic closed 1 year ago

dpancic commented 2 years ago

In GitLab by @stefanprobst on Feb 17, 2022, 16:41

currently, when providing an empty query parameter on a dynamic-property query, the server returns 500.

would be great if this could be handled more gracefully, i.e. empty query params are ignored.

example:

curl "https://sshoc-marketplace-api.acdh-dev.oeaw.ac.at/api/actor-search?d.name="

error:

{"timestamp":"2022-02-17 15:39:12","status":500,"error":"Error from server at http://solr:8983/solr: org.apache.solr.search.SyntaxError: Cannot parse 'name:': Encountered \"<EOF>\" at line 1, column 5.\nWas expecting one of:\n    <BAREOPER> ...\n    \"(\" ...\n    \"*\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    <REGEXPTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <LPARAMS> ...\n    \"filter(\" ...\n    <NUMBER> ...\n    ; nested exception is org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://solr:8983/solr: org.apache.solr.search.SyntaxError: Cannot parse 'name:': Encountered \"<EOF>\" at line 1, column 5.\nWas expecting one of:\n    <BAREOPER> ...\n    \"(\" ...\n    \"*\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    <REGEXPTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <LPARAMS> ...\n    \"filter(\" ...\n    <NUMBER> ...\n    "}
dpancic commented 2 years ago

In GitLab by @tparkola on Feb 22, 2022, 14:53

Empty query params, with code but no expressions are ignored, treated as no query was sent, therefore retuned all. Code on dev.