Why don't you just pass the query in here? That's all you are using from the params.