New method to generate key range from a scan.