pub struct ScoringPolicy {
pub schema_version: u32,
pub attribution: AttributionMultipliers,
pub verification: VerificationMultipliers,
pub freshness: FreshnessParams,
pub deprecation: DeprecationParams,
pub version_match: VersionMatchMultipliers,
pub blend: BlendWeights,
}Expand description
Full scoring-policy shape — every section is independently overridable.
Fields§
§schema_version: u32Schema sentinel. Always 1 in v1.
attribution: AttributionMultipliersAttribution-based trust multipliers.
verification: VerificationMultipliersVerification-based trust multipliers.
freshness: FreshnessParamsFreshness decay parameters.
deprecation: DeprecationParamsDeprecation penalty.
version_match: VersionMatchMultipliersVersion-target match multipliers.
blend: BlendWeightsTrust × relevance blend weights.
Implementations§
Source§impl ScoringPolicy
impl ScoringPolicy
Sourcepub const fn attribution_multiplier(&self, attribution: Attribution) -> f64
pub const fn attribution_multiplier(&self, attribution: Attribution) -> f64
The attribution multiplier for one Attribution variant.
Sourcepub fn verification_multiplier(
&self,
verified: bool,
verified_by: Option<&str>,
) -> f64
pub fn verification_multiplier( &self, verified: bool, verified_by: Option<&str>, ) -> f64
The verification multiplier, keyed off whether the content was verified
and who verified it. Unverified content always lands on the lowest
unverified multiplier, so any verified result outranks it (#3).
Sourcepub fn freshness_multiplier(&self, age_days: i64) -> f64
pub fn freshness_multiplier(&self, age_days: i64) -> f64
The exponential freshness multiplier exp(-age_days / half_life_days).
Negative ages (clock skew) are treated as zero (fully fresh).
Sourcepub fn version_multiplier(&self, class: &MatchClass) -> f64
pub fn version_multiplier(&self, class: &MatchClass) -> f64
Map a crate::version_match::MatchClass to its trust multiplier
using the [version_match] policy knobs (spec §3.3): linear steps with
a floor. Breaking maps to floor for completeness — callers drop
Breaking candidates before scoring.
Sourcepub fn confidence(&self, trust_score: f64, relevance: f64) -> f64
pub fn confidence(&self, trust_score: f64, relevance: f64) -> f64
Blend trust and relevance into a confidence in [0, 1].
confidence = clamp(trust^trust_weight * relevance^relevance_weight).
Sourcepub fn score(
&self,
provenance: &Provenance,
version: Option<&VersionScoreInput>,
age_days: i64,
relevance: f64,
relevance_source: RelevanceSource,
) -> ScoreResult
pub fn score( &self, provenance: &Provenance, version: Option<&VersionScoreInput>, age_days: i64, relevance: f64, relevance_source: RelevanceSource, ) -> ScoreResult
Score one candidate end to end: trust, blended confidence, and the
per-factor breakdown. relevance must already be normalized to [0, 1]
— via normalize_rrf for RRF scores, or directly for Voyage relevance
scores (which Voyage already returns in [0, 1]).
Source§impl ScoringPolicy
impl ScoringPolicy
Sourcepub fn parse(body: &str) -> Result<Self, ScoringPolicyError>
pub fn parse(body: &str) -> Result<Self, ScoringPolicyError>
Parse a scoring-policy TOML body.
§Errors
Returns ScoringPolicyError::Parse if the TOML is malformed,
ScoringPolicyError::SchemaVersionMismatch if the schema sentinel
disagrees, or ScoringPolicyError::NonFiniteWeight if any numeric
weight is not a finite, non-negative f64.
Trait Implementations§
Source§impl Clone for ScoringPolicy
impl Clone for ScoringPolicy
Source§fn clone(&self) -> ScoringPolicy
fn clone(&self) -> ScoringPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScoringPolicy
impl Debug for ScoringPolicy
Source§impl Default for ScoringPolicy
impl Default for ScoringPolicy
Source§impl<'de> Deserialize<'de> for ScoringPolicy
impl<'de> Deserialize<'de> for ScoringPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ScoringPolicy
impl PartialEq for ScoringPolicy
Source§fn eq(&self, other: &ScoringPolicy) -> bool
fn eq(&self, other: &ScoringPolicy) -> bool
self and other values to be equal, and is used by ==.