query detect