- _extract_short_addr handles Свердловская область / Россия / г. prefixes,
drops trailing кв./корп./оф., anchors on street keywords (ул./пр./пер./…)
- Tier S ORDER BY scraped_at DESC (was constant relevance_score=0.0)
- Drop ext_house_id kwarg (column never existed on listings table)
- 7 unit tests for _extract_short_addr covering real address formats
Closes 4 deferred items from gendesign-review-bot fa43ea8 review.
- Remove redundant int() around round() — RUF046
- Wrap long f-strings in _compute_confidence to stay within 100 chars
- Simplify photo_url expression in _listing_to_analog
Currently year/house_type only influence relevance sort. For a 17-эт. 1975
building we returned 5-9 эт. брежневки as analogs.
Three tiers:
- S (same building): address ILIKE prefix, ≥3 → return only these
- H (same class): year ±15, total_floors ±30%, ≥5 → return
- W (wide): current logic without year/floors WHERE filter
Tier propagated to confidence_explanation so user sees why analogs may differ.
Source: estimate a0a0b820-e8a8-4eee-aa73-0ab3b98ac233.