sqrt
Generic Description
Computes the square root of a non-negative numeric value. It is documented separately because numeric transforms change ranking, thresholds, and buckets in ways planner tools must not guess.
Simple example:
RETURN sqrt(16.0) AS value
Consumer-Level Explanation
Use it in normalization, Euclidean-style scoring, and dampening formulas where raw scale is too aggressive. Prefer this function when the transformation is a deliberate part of the model or report, and name the derived value in a WITH stage when it will be reused.
More Detailed Explanation
sqrt is scalar math, so it is evaluated per row after graph patterns, procedure output, or map projections have produced values. Keep it close to the query when thresholds, ranking, and derived fields need to be auditable and reproducible.
Advanced Example
This example applies sqrt to a named score component after matching graph data, making the derived metric reviewable before ordering.
MATCH (d:Document)
WITH d, properties(d).prize AS priority
RETURN d.title AS document,
sqrt(priority) AS damped_priority
ORDER BY damped_priority DESC
Real Use Cases
- distance-from-target scoring
- numeric bucketing and normalization before
ORDER BYor aggregation - making scoring formulas visible to query review and assistant tooling
Real Limitations And Tradeoffs
- invalid numeric inputs produce null-like results rather than a repaired value
- math functions do not fix poor feature scaling; choose transformations intentionally
- nondeterministic functions such as random sampling are not appropriate for persisted decisions