I'm going to have `search` throw an `IllegalArgumentException` if `maxDistance < 0` to avoid any confusion, and update the Javadoc accordingly.