pub struct ScoringSpec {
pub terms: Vec<ScoringTerm>,
pub decay: Vec<DecayTerm>,
}Expand description
Typed, host-injectable rerank scoring.
A spec is a weighted sum of features multiplied by exponential decay
factors. The engine evaluates it one candidate at a time; a plan carries
only ScoringSpec::shape_fingerprint, so changing weights never
invalidates a cached plan.
Fields§
§terms: Vec<ScoringTerm>§decay: Vec<DecayTerm>Implementations§
Source§impl ScoringSpec
impl ScoringSpec
Sourcepub fn weighted_scores(search_weight: f64, graph_seed_weight: f64) -> Self
pub fn weighted_scores(search_weight: f64, graph_seed_weight: f64) -> Self
Weighted sum over the two retriever scores.
pub fn validate(&self) -> Result<(), ScoringSpecError>
Sourcepub fn shape_fingerprint(&self) -> String
pub fn shape_fingerprint(&self) -> String
Feature shape without weights: the identity that belongs in a plan fingerprint or cache key.
Sourcepub fn needs_canonical_node_properties(&self) -> bool
pub fn needs_canonical_node_properties(&self) -> bool
Whether this spec reads canonical node properties. Callers use it to avoid loading a node record for specs that only need retriever scores.
Sourcepub fn evaluate(
&self,
source: &impl ScoringFeatureSource,
reference_time_millis: u64,
) -> ScoringEvaluation
pub fn evaluate( &self, source: &impl ScoringFeatureSource, reference_time_millis: u64, ) -> ScoringEvaluation
Evaluates one candidate. Missing features contribute nothing and are reported instead of silently ranking as zero-valued hits.
Sourcepub fn evaluate_score(
&self,
source: &impl ScoringFeatureSource,
reference_time_millis: u64,
) -> f64
pub fn evaluate_score( &self, source: &impl ScoringFeatureSource, reference_time_millis: u64, ) -> f64
Evaluates the same score without allocating a per-row diagnostic report.
Validate the specification before execution. Missing features retain
the same neutral behavior as Self::evaluate; use that method when
the caller needs feature provenance and individual contributions.