geoadmin / mf-geoadmin3

Legacy source code of map.geo.admin.ch
https://map.geo.admin.ch
Other
227 stars 72 forks source link

Object information (Advanced tools) does not find from pull-down in certain circumstances #4471

Closed AFoletti closed 6 years ago

AFoletti commented 6 years ago

Steps to reproduce:

Result:

Expected result:

Note:

Thanks for having a look!!

procrastinatio commented 6 years ago

Requests are https://mf-chsdi3.int.bgdi.ch/gas_bakom_notruf/rest/services/all/MapServer/ch.bakom.notruf-112_mobilnetz/attributes/mobile_112 and https://mf-chsdi3.int.bgdi.ch/gas_bakom_notruf/rest/services/all/MapServer/ch.bakom.notruf-112_mobilnetz/attributes/mo_addresse_112

Looks OK to me

advandced

AFoletti commented 6 years ago

Sorry @procrastinatio , are you telling me that by following the steps I described you are getting a result? Because I'm consistently getting none...

ltclm commented 6 years ago

there are line feeds in the database, that's why the ilike is not working. This is the query string which is not working:

http://localhost:9076/rest/services/all/MapServer/identify?geometryFormat=geojson&imageDisplay=1169,803,96&lang=en&layers=all:ch.bakom.notruf-112_mobilnetz&mapExtent=2454734.813976,1000064.9423119999,2952121.6260240003,1341725.857688&returnGeometry=true&sr=2056&tolerance=5&where=mo_addresse_112 ilike '%Etat de Genève Police Cantonale
Chemin de la Gravière 9
1227 Les Acacias%'

I think you need the line feeds for the tooltip. For each queryable attribute with line feeds, you could add a (queryable attribute search only) column to the view and replace line feeds with space

regexp_replace(mo_addresse_112, '\r|\n', ' ', 'g') as mo_addresse_112_queryable

This is how the values for the selection are generated: image line feeds are replaced with spaces by the json renderer. So they're not visible here: http://localhost:9076/rest/services/all/MapServer/ch.bakom.notruf-112_mobilnetz/attributes/mo_addresse_112

AFoletti commented 6 years ago

Thanks for your analysis @ltclm Do we need to add a column to a view in order to solve the problem or could we solve it in the sphinx config? This would spare us some tinkering with the DB

ltclm commented 6 years ago

you have to add columns to the view. sphinx is not involved in the queryable attribute stuff.

ltclm commented 6 years ago

an alternative solution would be: https://github.com/geoadmin/mf-chsdi3/blob/ee88d1b4323b27fbe4630434e833874aa4f841a5/chsdi/lib/helpers.py#L185

replace line feeds with % when generating the ilike string, but im not sure about side effects, i can give it a try if you want.

AFoletti commented 6 years ago

Personally I would like a general solution better than a per-layer one. We could very well encounter the same issue in other layers (and we probably we already have that... we simply did never notice the issue) and it would be stupid to have to add a special column just to solve this issue.

But I understand that the general solution in chsdi is more demanding in terms of time.

@danduk82 and @gjn your opinion?

ltclm commented 6 years ago

pr and testlink are here: https://github.com/geoadmin/mf-chsdi3/pull/2978

AFoletti commented 6 years ago

Well, that was fast

AFoletti commented 6 years ago

fixed with https://github.com/geoadmin/mf-chsdi3/pull/2978