middleware search