Refactor text_search method.

For scopes that only take one parameter use the simplified method that loops through each parameter and uses the corresponding scope. This means we can remove the parameter presence check from the scopes.

Clean up the controller by moving the `tables` variable to a private method.