Advanced search returning 'Key "1" for array with keys "0" does not exist'
This error could happen if the p param is set to something, but the value doesn’t actually contain a hyphen.

If you want to find out what the problematic value is, enable Dev Mode and then check your browser console > Application Log > GET Info or POST Info (depending on the request type).

To make your code more bulletproof you can replace this line:

{% set price = price ? price|split('-') %}


with:

{% set price = (price and price matches '/-/') ? price|split('-') %}