Set query length and threshold max