Adapt query.