klokantech / osmnames-sphinxsearch

Geocoder search engine for OSMNames.org data powered by sphinx search
https://osmnames.org/
MIT License
77 stars 24 forks source link

Contextualy improved `name_suffix` #33

Closed klokan closed 8 years ago

klokan commented 8 years ago

By looking at the 20 candidates which are supposed to be delivered as results we can apply logic on recreating an alternative to long "display_name" to something shorter and distinguishable between the different results.

The target is to get something close to what Google gazetteer provides. Try it on Search Box in http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/

For place name - only country follows, US has as a two-letter state prefix, streets have "city, country". If in the results are equal (two records with the same name, name_suffix) we have to improve at least one of the name_suffix to distinguish the results.

For Nominatim we have done something similar in JavaScript, but it was ugly code: https://github.com/klokantech/javascript/blob/master/src/nominatimmatcher.js#L127 On the server side, it could be done probably better.

klokan commented 8 years ago

The clients should implement a look and feel similar to Google: screen shot 2016-09-08 at 18 40 53

The rule should be: If "name_suffix" is present in JSON response, then show (with lighter font) after the "name" (larger, darker font) - instead of showing only "display_name" alone.

We may also display type on the right. Or in some cases show geographical distance to lat/lng in prefix (as on the mobile apps).

I see the fields "formatted_name" and "formatted_type" in use by @petrsloup in our JavaScript code for OSMNames already: https://github.com/klokantech/javascript/search?utf8=%E2%9C%93&q=formatted_name This should be probably removed (and not used).

petrsloup commented 8 years ago

The formatted_name and formatted_type were just temporary keys in the javascript -- this was not present in the json at all.

Now the javascript displays <span class="name">name</span><span class="suffix">name_suffix</span><span class="type">type</span> with basic styling: https://github.com/klokantech/styles/commit/e552d8018b9ca6fa3fb08c9257d8d989d9321d03

However, I don't see name_suffix in any of the json response at the moment...

Is this how the javascript should handle this?

klokan commented 8 years ago

Miki is implementing the "name_suffix" on server side. This is where the logic should be done.

The client should show either display_name or name+name_suffix (if name_suffix is available).

petrsloup commented 8 years ago

The javascript implementation is done. It now displays either name name_suffix or display_name (if suffix is not provided).

klokan commented 8 years ago

@petrsloup great! Thanks. Could you please ensure the height of each column is fixed?

klokan commented 8 years ago

URGENT - Why is this not yet deployed. I am suppose to announce the project tomorrow morning!!!!

MartinMikita commented 8 years ago

First version is now deployed.

If any changes are required, reopen this ticket.