KorAP / Kalamar

:octopus: Mojolicious-based Frontend for KorAP
BSD 2-Clause "Simplified" License
7 stars 2 forks source link

Long queries fail with »Parameter "q" invalid« #169

Closed kupietz closed 2 years ago

kupietz commented 2 years ago

Long valid queries which work via the API, such as this fail in the web UI as shown here.

Akron commented 2 years ago

Ah - I see. I guess we limit it to 1000 because of Browser support. I am not sure about the current situation, but there are different limits for different browsers, that are not defined per se for URLs. But if we want to support copy'n'paste between different browsers for Queries (and I think the problem was Edge), we should limit the supported characters to the lowest supported amount. Maybe a solution would be to limit the query parameter for the API as well, while this still leaves problems for long cq-parameters.

Akron commented 2 years ago

Alternatively we may be able to check the browser limits and give meaningful error messages for these.

kupietz commented 2 years ago

I think we should increase the limit to about 4096 and provide a better error message in addition, see: https://korap.ids-mannheim.de/gerrit/c/KorAP/Kalamar/+/5897

Edge doesn't matter much in comparison, I think.

Akron commented 2 years ago

And what is the reasoning behind 4096? Should this as well be the limit for the API?

I think, compatibility with Edge should be still supported. Having a query behave differently in different browsers, because the query string is truncated, is not a good option. But honestly I don't know if the URL is just truncated in the URL bar of the browsers or send truncated ...

I think, longer queries shouldn't use GET at all ...

kupietz commented 2 years ago

Yes, let's rather use the limit of the API. I just couldn't figure it out in time. 4096 is just as arbitrary as 1000 (also unrelated to Edge), but will avoid the problem in almost all cases, for the Rechtschreibrat. It's not like with vc definitions that can often get much larger. Queries can get big for excluding false positives, but not much bigger. There is no reason to limit them to 1000 characters. (Edge users will be used to trouble and probably get a good error message :)

kupietz commented 2 years ago

Maybe 4096 is a good compromise in our case: https://stackoverflow.com/questions/812925/what-is-the-maximum-possible-length-of-a-query-string