increase penalty on mismatching postcodes for address searches

Otherwise there is an imbalance towards matching housenumbers
instead of the actual street (where no housenumber exists).
This commit is contained in:
Sarah Hoffmann
2025-07-07 16:07:32 +02:00
parent 970d81fb27
commit 3e04eb2ffe

View File

@@ -230,7 +230,8 @@ class AddressSearch(base.AbstractSearch):
tpc = conn.t.postcode
pcs = self.postcodes.values
pc_near = sa.select(sa.func.min(tpc.c.geometry.ST_Distance(t.c.centroid)))\
pc_near = sa.select(sa.func.min(tpc.c.geometry.ST_Distance(t.c.centroid)
* (tpc.c.rank_search - 19)))\
.where(tpc.c.postcode.in_(pcs))\
.scalar_subquery()
penalty += sa.case((t.c.postcode.in_(pcs), 0.0),