Geo, interpolation, geocode
Spatial indexing, address-number interpolation, and the forward/reverse geocode glue built on top.
What's working (crates/farnsworth-geo-spike)
Tested at full production scale: 13,914,016 real POIs, all countries, no sampling shortcuts.
rstar(R-tree), two-step query design matching how real geo search engines (including OpenSearch'sgeo_distanceinternally) do it: a fast, coarse degree-based bounding-radius prune vialocate_within_distance, then an exact haversine distance filter/sort on the smaller candidate set.- Build: the full 13.9M-point corpus indexed in 8-9s.
- Memory: peak RSS 13.76GB for the full corpus (corrected down from an initial 15.5GB after fixing a real double-storage bug in the spike - see the roadmap for detail).
- Query: NYC-area radius search (1/10/50km) returns correctly distance-sorted real POIs in 3-29ms. Sparse rural Montana queries in sub-100 microseconds, correctly scaling hit count with radius (0 -> 2 -> 5 hits).
- Point-in-polygon (
geocrate'sContains, real GeoJSON admin boundaries): 3,000/3,000 shapes parsed with zero failures, 99.8% self-containment sanity check, correct reverse point-in-polygon lookups.
This is the piece an independent fresh-eyes review flagged as standing on its own merit regardless of the text-engine outcome - unlike the JVM/GC-removal argument, which the baseline spike disproved. The full-scale result confirms that read cleanly: unlike text search, geo held up completely at real production scale with no surprises.
Address interpolation (crates/farnsworth-core/src/bin/interpolation.rs)
The full 11-country address migration was too large for this learning project's remaining scope - bounded instead to validating the one genuinely new mechanic: house-number interpolation, against real French address data.
Read localities' actual algorithm directly (localities/suggestions/suggestion.py), not guessed: filter known addresses to the target number's parity (falling back to the other parity if empty), sort, binary search, and linearly interpolate lat/lon between the two bracketing known addresses by numeric ratio - a straight line between two known points, not geometric interpolation along street geometry. Out-of-range numbers snap to the nearest known endpoint.
Reproduced exactly in Rust and validated with holdout testing against real data: for every street with 3+ known addresses of the same parity, hold one out, interpolate it back from its remaining neighbors, measure the real error against its actual location. 48,312 holdout predictions across 3,836 real French streets:
| Percentile | Error |
|---|---|
| Median | 11.1m |
| p90 | 62.0m |
| Max | 4760.2m |
Not a Farnsworth-specific finding - this is the accuracy profile of the algorithm itself, wherever it runs, measured with real ground truth for the first time. Typical accuracy is good (building-scale). The tail reveals a real, general limitation: some streets have numbering that doesn't correlate smoothly with geographic position, where linear number-based interpolation can be meaningfully wrong regardless of engine.
Details and geocode (crates/farnsworth-core)
Asked directly: how likely are autocomplete/details/geocode to actually work on Farnsworth? Honest answer at the time - autocomplete strong (main focus of the text-engine work), details untested but low-risk, geocode a real gap (text matching and interpolation math both proven separately, never connected). Built both missing pieces.
Details (PoiSearchIndex::details): exact lookup by public_id via a TermQuery on the already-indexed field - the same mechanism a real point lookup would use, not a side shortcut. 2 tests.
Geocode (src/geocode.rs) - the actual missing glue: parses a street number out of free text (leading or trailing), text-matches the street name (reusing the proven autocomplete query), then interpolates the number's position with the exact algorithm above. 12 tests (parsing, exact match, interpolation, street-only fallback, disambiguating streets, unknown streets).
Real-data demo against the FR sample:
"Route de Menerbes" -> street-only, general location
"210 Route de Menerbes" -> exact (210 is a known address)
"500 route de menerbes" -> interpolated (not a known number)
"route de nantes" -> correctly resolves to the DIFFERENT street
Reverse geocode (GeocodeIndex::reverse_geocode): given a point, find the nearest known address - pure spatial nearest-neighbor (rstar, the same crate and mechanism proven at full 13.9M-point scale above), not text search. 3 tests. Real-data round-trip check: forward-geocoded "210 Route de Menerbes" to a coordinate, then reverse-geocoded that exact coordinate back - correctly returns street="Route de Menerbes" number=210 distance=0.000km.
Full workspace: 45/45 tests passing (at the time this was landed). Caveat: still scoped to one country's schema (FR), and the number-splitting is a simple leading/trailing heuristic, not a full address parser across all 11 countries' formats.