GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Confusion with alternate names.  XML
Forum Index -> General
Author Message
andrew c



Joined: 04/10/2007 22:26:58
Messages: 1
Offline

Hi,

I have downloaded the db dump to a local database, including the alternatenames table. I am using the data in an Ajax enabled user interface. As the user types a placename a search is performed on the partial name they have entered, and they are presented with a list of possible matches (I therefore need a response time in the range of a couple of hundreds of milliseconds, which I have achieved with a search on asciiname for a specific fclass and ordering by size of place (based on fcode) and by limiting the number of matches to around 25). I had been hoping to avoid language issues and have so far just been using the asciiname column from the geonames table for these searches. However I came across a problem with 'Moscow'. It doesn't exist in the geoname table; it is recorded as moskva. It is of course listed in alternatenames.

I am struggling to understand exactly how I can use alternate names - it doesn't contain the primary name for places, so it seems I need to do a search on both the asciiname column from the geoname table and the alternatename column from the alternatenames table. What I want to achieve is that when the user types 'mosc' a scan of the alternatename column will identify that there is a match and I can then lookup and return the primary name for location (so in this case 'moskva' will be displayed to the user, even though they type 'mosc'). My SQL and indexing skills don't appear up to the task of doing this efficiently while combining this search with a search of asciiname, required to find places which aren't listed in alternatenames, or where the match appears in the the place's primary name. Given that I have a result size limit (and a target lookup time) I don't want to have to find all possible matches, then order them, as for small strings (e.g. 'mo') this would take a long time.

I feel like I may have completely misunderstood how to use the alternatenames table! (I am presuming that I don't want to try and do this search on the comma separated list which is the alternatename column in the main database, as this doesn't seem likely to provide good search performance as I don't see how each item in the lists could be indexed.)

I notice that the geonames webservice successfully performs exactly what I am asking for! A hint as to the workings of your algorithm could be exactly what I need...

Thanks,

Andrew.
marc



Joined: 08/12/2005 07:39:47
Messages: 4486
Offline

Hi Andrew

The main name and the alternate names table are not yet redundant. You will have to implement a search on both fields or a combination of both fields.

We don't use mysql. The search is a full text search using the apache fulltext search library lucene : http://lucene.apache.org/

Regards

Marc

[WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team