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
{{ message }}
Repository navigation
geo search: variable center bound to a WKT string from an indexed scan resolves to no center #1318
GeoSearchOperator::resolve_center (fluree-db-query/src/geo_search.rs, ~line 111) resolves a variable-bound center by matching:
match binding {Binding::Lit{ val, .. } => match val {FlakeValue::GeoPoint(bits) => Some((bits.lat(), bits.lng())),FlakeValue::String(s) => fluree_db_core::geo::try_extract_point(s),
_ => None,},
_ => None,}
On a fully-indexed ledger with late materialization active, a WKT string literal bound from a scan arrives as Binding::EncodedLit (string-dict backed), which falls into the _ => None arm — the center silently resolves to nothing and the geo search yields no results, instead of decoding the string.
Embedded geo:Point values are NOT affected: late_materialized_object_binding has no encoded representation for DecodeKind::GeoPoint, so those fall back to materialized Lit { GeoPoint } bindings and match the first arm.
Evidence
Code-level only (no runtime repro built yet — needs a dataset where the center variable is bound to a WKT string by a preceding indexed triple pattern). The sibling operator already handles this exact case: s2_search.rs::resolve_query_geom has an explicit Binding::EncodedLit arm that decodes via gv.decode_value_from_kind(..) before parsing the geometry.
Suggested fix
Mirror the s2_search.rs pattern: add an EncodedLit arm to resolve_center that decodes string-dict values through the graph view and feeds the result to try_extract_point. Verify with a repro first (variable WKT center from an indexed scan).
Sweep verification at 47e96b7b6, with a twist: the code-level diagnosis here is correct — geo_search.rs:120-127 is missing the EncodedLit arm that s2_search has — but GeoSearchCenter::Var is never constructed anywhere at current main. The only GeoSearch builder is the geof:distance rewrite, which requires a constant WKT and emits Const centers only. A variable-center query demonstrably takes the generic path and returns correct rows on an indexed ledger (CLI repro, 2/2 expected rows).
So there's no live wrong-results path today; the bug arms itself the moment someone wires variable centers into the rewrite. Two cheap ways to handle that, and I'm fine with either: (a) add the EncodedLit arm now, mirroring s2_search, as defense-in-depth — it's S-effort; or (b) rescope this issue to "variable geo-search centers are unimplemented — when implementing, the resolve_centerEncodedLit gap must be fixed with them" so the trap is documented where the future implementer will trip it.
Activity
aaj3f commentedon Aug 25, 2026
Sweep verification at
47e96b7b6, with a twist: the code-level diagnosis here is correct —geo_search.rs:120-127is missing theEncodedLitarm thats2_searchhas — butGeoSearchCenter::Varis never constructed anywhere at current main. The only GeoSearch builder is thegeof:distancerewrite, which requires a constant WKT and emitsConstcenters only. A variable-center query demonstrably takes the generic path and returns correct rows on an indexed ledger (CLI repro, 2/2 expected rows).So there's no live wrong-results path today; the bug arms itself the moment someone wires variable centers into the rewrite. Two cheap ways to handle that, and I'm fine with either: (a) add the
EncodedLitarm now, mirrorings2_search, as defense-in-depth — it's S-effort; or (b) rescope this issue to "variable geo-search centers are unimplemented — when implementing, theresolve_centerEncodedLitgap must be fixed with them" so the trap is documented where the future implementer will trip it.