Only attempt to optimize string or URI comparisons

As numeric comparisons cannot be directly converted to a BGP match.