Added `_name` support to queries.

This extends the named filter support from only filters to also queries.

Closes #3581