Query Hashability

This changeset adds functionality to make `Query` objects hashable, so they may be used like `dict[query]` and the like.