adapt query