Zip code or city/state distance search.
I have a search box that I want a user to enter a zip code or a city/state and then it calculates the latitude/longitude of that location, and then it finds the closest location of the offices i have stored in the sitecore content tree. How can I do this?
I have sorting working based on my current location. And that seems to be working well. But I haven't figured out this other part.
I believe this is the documentation you are looking for.
You need to set the coordinates of your user by code. We call this adding a Geolocation Provider.
The code you need to add will find the `CoveoForSitecoreDistanceResources` component and call its method `setDistance`.
Note: you might be using the `CoveoDistanceResources` component, which is the for Sitecore component equivalent in the Coveo Search UI (the for Sitecore component was so awesome that it was ported to the search UI). If this is the case the method you want to call is named setPosition.