You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR 3 of the staged sequence tracked in #655.
New OsmCandidate<'a> (matchers/mod.rs): pairs a tables::Feature with the
StringPool needed to resolve its tag ids -- kept as its own type (rather
than threading &Feature/&StringPool through Matcher separately) so a
future hydration step (e.g. a pre-decoded geo::Geometry for
Hausdorff-distance scoring, or a pre-tokenized name for Token Sort
Ratio matching) can attach fields here without another trait-signature
change. tags() is cheap; geometry() decodes WKB and is not, so callers
should only reach for it when they actually need the shape.
trait Matcher gains a new score_osm_candidate(&self, &OsmCandidate)
method, alongside the existing Place-based score/suggest_edit -- not
replacing them yet, so conflate.rs/edits.rs don't need to change in
this PR at all (they still go through Place/PlaceIndex). Needs to be a
trait method, not just an inherent method on PoiMatcher: conflate/edits
call through Box<dyn Matcher>, so a later PR that wires this in can't
reach an inherent method that isn't on the trait object.
PoiMatcher::score_osm_candidate mirrors score's brand:wikidata-based
logic, but checks the (cheap) tag match before decoding the (not
cheap) geometry, unlike score's current unconditional-then-check order
-- Place's distance was already free to compute, Feature's isn't.
Since Feature has no precomputed position (unlike Place's s2_cell_id),
distance is computed from the decoded geometry's centroid; added
geo_point_distance/geo_point_distance_score alongside the existing
Place-based distance/distance_score for this. Also extracted
find_brand_wikidata(), shared by for_place/score/score_osm_candidate
instead of duplicating the same tag scan three times, and deduplicated
a stray inline EARTH_RADIUS_METERS constant into one module-level one.
Tests: ported test_poi_matcher's CH_CLOTHES/CH_KIOSK fixtures to
Feature/StringPool (reusing the same real-world coordinates via their
s2_cell_id, so this exercises the WKB-decode-then-centroid path
against genuine positions), plus direct unit tests for
OsmCandidate::tags/geometry and geo_point_distance_score.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments