Encoding query