master refactorisation for peoplesearch and get_connection