complete search function