MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / apply_predicate

Function apply_predicate

nodedb/src/data/executor/handlers/spatial.rs:312–326  ·  view source on GitHub ↗

Apply the spatial predicate.

(
    predicate: &SpatialPredicate,
    query: &nodedb_types::geometry::Geometry,
    doc: &nodedb_types::geometry::Geometry,
    distance_meters: f64,
)

Source from the content-addressed store, hash-verified

310
311/// Apply the spatial predicate.
312fn apply_predicate(
313 predicate: &SpatialPredicate,
314 query: &nodedb_types::geometry::Geometry,
315 doc: &nodedb_types::geometry::Geometry,
316 distance_meters: f64,
317) -> bool {
318 match predicate {
319 SpatialPredicate::DWithin => {
320 crate::engine::spatial::st_dwithin(query, doc, distance_meters)
321 }
322 SpatialPredicate::Contains => crate::engine::spatial::st_contains(query, doc),
323 SpatialPredicate::Intersects => crate::engine::spatial::st_intersects(query, doc),
324 SpatialPredicate::Within => crate::engine::spatial::st_within(doc, query),
325 }
326}
327
328/// Apply projection to a document, returning `nodedb_types::Value`.
329fn project_doc(doc: &Value, doc_id: &str, projection: &[String]) -> Value {

Callers 2

execute_spatial_scanMethod · 0.70
spatial_full_scanMethod · 0.70

Calls 4

st_dwithinFunction · 0.85
st_containsFunction · 0.85
st_intersectsFunction · 0.85
st_withinFunction · 0.85

Tested by

no test coverage detected