refactor SearchController::complexSearch() and code style adjustments