solution for range search