From d9b4d1591dfef782b23281e25cf7ebeac06c2caa Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 12 Dec 2024 19:02:00 +0100 Subject: [PATCH] ignore postcode areas on reverse Postcode lookups are best done by doing reverse at a higher level and then extracting the postcode. --- src/nominatim_api/reverse.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nominatim_api/reverse.py b/src/nominatim_api/reverse.py index 8a75c5b94..c9f11b632 100644 --- a/src/nominatim_api/reverse.py +++ b/src/nominatim_api/reverse.py @@ -362,6 +362,8 @@ def _base_query() -> SaSelect: # later only a minimum of results needs to be checked with ST_Contains. inner = sa.select(t, sa.literal(0.0).label('distance'))\ .where(t.c.rank_search.between(5, MAX_RANK_PARAM))\ + .where(t.c.rank_address != 5)\ + .where(t.c.rank_address != 11)\ .where(t.c.geometry.intersects(WKT_PARAM))\ .where(sa.func.PlacexGeometryReverseLookuppolygon())\ .order_by(sa.desc(t.c.rank_search))\