Use anonymous function to create searchProto