First, they try bucketing sentences by length to limit the number of sentences in the example base that have to be compared against the input, assuming that similar sentences will have similar length.
the best match is not guaranteed to be found when this heuristics is used.