mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 05:18:00 +00:00
restrict pre-selection by postcode to country
This commit is contained in:
@@ -175,10 +175,11 @@ class AddressSearch(base.AbstractSearch):
|
||||
sql = sql.where(t.c.country_code.in_(self.countries.values))
|
||||
|
||||
if self.postcodes:
|
||||
if not self.has_address_terms or self.expected_count > 10000:
|
||||
if self.expected_count > 10000:
|
||||
tpc = conn.t.postcode
|
||||
sql = sql.where(sa.select(tpc.c.postcode)
|
||||
.where(tpc.c.postcode.in_(self.postcodes.values))
|
||||
.where(tpc.c.country_code == t.c.country_code)
|
||||
.where(t.c.centroid.within_distance(tpc.c.geometry, 0.4))
|
||||
.exists())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user