implement inQuery and notInQuery operations