Mercurial > gemma
diff pkg/controllers/search.go @ 1109:74a75a5ce770
Added geonames data and extended search for villages/cities.
The free data from geonames https://download.geonames.org/ is imported
into the gemma data base (for the relevant states) and used to search
for cities and villages.
This data might be replaced by data from the RIS-index later on..?
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Mon, 05 Nov 2018 13:07:16 +0100 |
parents | 146245d2198f |
children | 5443f5c9154c 53057ab27ff2 |
line wrap: on
line diff
--- a/pkg/controllers/search.go Fri Nov 02 17:21:33 2018 +0100 +++ b/pkg/controllers/search.go Mon Nov 05 13:07:16 2018 +0100 @@ -30,12 +30,7 @@ FROM waterway.distance_marks_virtual WHERE (location_code).hectometre = $1) r` - searchBottleneckSQL = `SELECT COALESCE(json_agg(r),'[]') -FROM (SELECT objnam AS name, - ST_AsGeoJSON(ST_Centroid(area))::json AS geom, - 'bottleneck' AS type - FROM waterway.bottlenecks - WHERE objnam ILIKE $1) r` + searchMostSQL = `SELECT search_most($1)::text` listBottlenecksSQL = ` SELECT COALESCE(json_agg(r),'[]') @@ -95,8 +90,8 @@ // Hande search for bottlencks: err = db.QueryRowContext( req.Context(), - searchBottleneckSQL, - "%"+s.SearchString+"%", + searchMostSQL, + s.SearchString, ).Scan(&result) }