refactor index and search in controllers and models to be consistent and remove error with ambiguous column