Optional "exact" match
tmaiaroto opened this issue · 1 comments
It would be nice to have another function for exact matches. This would increase the lookup speed a little bit and could really help with ensuring accuracy. The data coming in would need to be pretty clean and reliable for this to work though.
There will likely be more matching functions to come, but for now an exact city match was added. Still used through Geocode()
but that function now accept an optional GeocodeOptions
struct with an attribute ExactCity
which, if set, will use this new exactMatchCity()
function.
This will first gather a slice of GeobedCity
where the city name is found in the search string (case insensitive). From there it will choose a best match based on any available state and country abbreviations. If no abbreviations were found to help narrow down potential cities by the same name, the city with the largest population will be taken.
This way, if a query comes in as "New York, USA" then New York, NY is assumed instead of a New York from another state. Quite frequently, locations are implied based on size or popularity.