I have Postgre database with network table that contains country, street name, numbers from left – to left, numbers from right-to right.
I finished geocoding function to use like this: user fills 3 text boxes for country, street and number and then I have query like this: Select * from network where country like (text box country) and street name like (text box street) …etc … For house number I have interpolation and the geocode function returns lon/lat.
Everything is fine with this function.
But I want to do geocoding like Google, user has only one text box and user can insert whatever he wants, and Google knows what to search.
For instance if user insert “Via Romma Palermo” or “Via Roma Palermo” or “Via Roma 16 palermo” Google always has the right answer and is very fast.
What is the trick? How to do fast search, do I need some algorithm for this or what? Do I need separate table for all addresses? How to handle errors in typing Romma, Roma …etc? How to know what is first country, street, what field in the database to search for?