From 55fdf0abdad5df83f170b78d9b42aed3715c0e97 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 28 Feb 2020 22:07:06 +0100 Subject: [PATCH] output linked place into address details --- lib/PlaceLookup.php | 2 +- sql/partition-functions.src.sql | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index fce49701..3531413f 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -215,7 +215,7 @@ class PlaceLookup 'ST_Collect(centroid)', 'min(CASE WHEN placex.rank_search < 28 THEN placex.place_id ELSE placex.parent_place_id END)' ); - $sSQL .= " (extratags->'place') AS extra_place "; + $sSQL .= " COALESCE(extratags->'place', extratags->'linked_place') AS extra_place "; $sSQL .= ' FROM placex'; $sSQL .= " WHERE place_id in ($sPlaceIDs) "; $sSQL .= ' AND ('; diff --git a/sql/partition-functions.src.sql b/sql/partition-functions.src.sql index 8f78032e..34b4d390 100644 --- a/sql/partition-functions.src.sql +++ b/sql/partition-functions.src.sql @@ -20,7 +20,8 @@ BEGIN FOR r IN SELECT place_id, keywords, rank_address, rank_search, min(ST_Distance(feature, centroid)) as distance, isguess, postcode, centroid FROM location_area_large_-partition- - WHERE ST_Intersects(geometry, feature) and rank_search < maxrank + WHERE ST_Intersects(geometry, feature) + AND rank_search < maxrank AND rank_address < maxrank GROUP BY place_id, keywords, rank_address, rank_search, isguess, postcode, centroid ORDER BY rank_address, isin_tokens && keywords desc, isguess asc, ST_Distance(feature, centroid) * -- 2.39.5