We currently have a site where objects can be searched for by location. We have a search box and a dropdown of states in our country. Each object has a relationship with one state.
We would like to expand this website into other countries. Our choices appear to be:
1/ For each country we want to go in to, we need a list of states and possibly post codes. The objects are associated with states and postcodes and a dropdown is provided alongside the search box.
2/ Associate a longitude and latitude to each object and have google api return a longitude and latitude for the address a user types when they search. Then find the objects which fall within a certain radius of the long/lat of the searched address.
Option 1 would perform well but is limited because we have to do a lot of work before entering each country (getting list of states/postcodes).
Option 2 seems like the most elastic and there would be no limit on going in to a new country. However, it would probably perform poorly if not done well. How would you avoid searching all objects in the table to find out of there long/lat falls withing the radius of the long/lat of the searched address?
We like how www.skillpages.com works. Very quick and accurate search and this is something we would like to replicate if we choose option 2.
Any advice on how best to create an accurate and elastic location based searching algoritm would be greatly appreciated.