default query middleware.