Refactor `Filter` to check different fields depending on the data type.