Detecting cycles in search