Refactor SearchParameterParser#filter method

Break the logic into small chunks that do one thing at a time to the
input data and gradually convert it into the right form for output,
and add the appropriate entries into `@errors` and `@used_params`.

These chunks would be suitable for extracting into separate methods
rather than leaving them all in `filter`.

Also slightly tweaks the behaviour so that invalid filters are not
returned. This won't impact the rest of the system, but is slightly
cleaner.