X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/03c373a4b3e031ab977c5bffb9f09731b28581a6..3db2b05069d68f8703a696273f4fdfc9fe6a445e:/sql/partition-functions.src.sql?ds=inline

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) *
