Conditionalize the query filters to avoid extra function calls.

This makes it so we aren't doing multiple function calls for non-existent arguments.

This seems to add between 1-10 more requests/second in some simple local benchmarks (`ab -c1 -n100`)