Handle search range more precisely

[fixes #74259904]