method processSearch modified to use pagination