query controller