sciencehistory / chf-sufia

sufia-based hydra app
Other
9 stars 4 forks source link

Check ranges in Blacklight before running searches. #1144

Closed eddierubeiz closed 6 years ago

eddierubeiz commented 6 years ago

We've seen a couple errors in production that have to do with searching within ranges (e.g. ranges of dates) in which the beginning and end of the range are either absent or in the wrong order. For instance, someone triggered a 500 error by searching for results between 1945 and 1939.

Will attach some links to recent errors.

eddierubeiz commented 6 years ago

Bugs to examine: https://github.com/sciencehistory/chf-sufia/issues/1125 (the corresponding honeybadger error has unfortunately expired.) https://app.honeybadger.io/projects/53196/faults/39201947 https://app.honeybadger.io/projects/53196/faults/39201881

eddierubeiz commented 6 years ago

Ideally, we would fix the parameter validation for the Blacklight range limit plugin, and submit fixes directly to the Blacklight project.

eddierubeiz commented 6 years ago

For the first bug (the one we already fixed on the front end ), see the latest version of blacklight_range_limit.

jcoyne simply checks for out-of-order range limits and throws a new, higher-level error: raise InvalidRange, "The min date must be before the max date" if min > max" which doesn't really help for our purposes.

To me this means that blacklight_range_limit expects us to validate range inputs ourselves (which we're doing).

As for the second and third bugs, they are suspicious in that I can't reproduce them (or anything that looks like them) by clicking around on the front end.

However, I can readily fix them by adding extra validation to collections_show_controller.rb .