1

As part of the FULL response style, the GeoNames search API returns results like the following:

<geonames style="FULL">
  <totalResultsCount>510</totalResultsCount>
    <geoname>
    <toponymName>Las Vegas</toponymName>
    <name>Vegas</name>
    <lat>36.17497</lat>
    <lng>-115.13722</lng>
    <geonameId>5506956</geonameId>
    <!-- abbreviated -->
    <score>92.10135650634766</score>
  </geoname>
</geonames>

How is the score element calculated? I'm guessing there's some sort of search index (e.g. something running on top of Lucene, like Solr or Elasticsearch).

I'm less concerned about exactly understanding the scoring algorithm they use, but rather an understanding which factors would be the most useful in implementing a scoring mechanism if I were to implement a similar web service locally.

1

I'm currently implementing a place name search service at work. The following are some criteria (in order of importance) I use to score place results:

  • Matching degree, i.e., exact matches get higher score than fuzzy ones.
  • Place name category. If your place name database happen to have historical names, you could give higher scores to preferred and alternate place names than to historical ones.
  • Place type: If your place types are somehow hierarchical like in thesauri (and depending on your use case), the higher (whatever that means) the category of a place, the higher the score. For instance, one could favor cities over municipalities, so that users searching for "Barranquilla" would get the city of Barranquilla first, and then the municipality of Barranquilla.
  • Population: The more inhabitants a place has, the higher its score. Population-based scoring is almost a must, because population highly correlates to the probability of searching for a specific place.

Additionally, you could use the proximity to a specific point (or containment with respect to a bounding box) as another criterion to rank place results.

Of course, depending on the search engine you use, you would be able to implement the whole set of aforementioned criteria or just some of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.