mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 05:14:07 +00:00
restrict name-only address searches early by postcode
This commit is contained in:
@@ -175,8 +175,7 @@ class AddressSearch(base.AbstractSearch):
|
|||||||
sql = sql.where(t.c.country_code.in_(self.countries.values))
|
sql = sql.where(t.c.country_code.in_(self.countries.values))
|
||||||
|
|
||||||
if self.postcodes:
|
if self.postcodes:
|
||||||
if self.expected_count > 10000:
|
if not self.has_address_terms or self.expected_count > 10000:
|
||||||
# Many results expected. Restrict by postcode.
|
|
||||||
tpc = conn.t.postcode
|
tpc = conn.t.postcode
|
||||||
sql = sql.where(sa.select(tpc.c.postcode)
|
sql = sql.where(sa.select(tpc.c.postcode)
|
||||||
.where(tpc.c.postcode.in_(self.postcodes.values))
|
.where(tpc.c.postcode.in_(self.postcodes.values))
|
||||||
|
|||||||
Reference in New Issue
Block a user