Check length of query