adding constraints handling in engine queries