Refactor of en_search_api.rb and search_controller.rb