constructed query in controller