use crate::traits::{MemoryMeta, ScoringStrategy};
pub struct ActivationScorer {
weight: f32,
}
impl ActivationScorer {
pub fn new(weight: f32) -> Self {
Self { weight }
}
}
impl Default for ActivationScorer {
fn default() -> Self {
Self::new(1.0)
}
}
impl ScoringStrategy for ActivationScorer {
fn score_multiplier(&self, _record: &MemoryMeta, _query: &str, _base_score: f32) -> f32 {
self.weight
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::traits::MemoryType;
use chrono::Utc;
#[test]
fn default_returns_weight() {
let scorer = ActivationScorer::default();
let meta = MemoryMeta {
id: Some(1),
searchable_text: "test".into(),
memory_type: MemoryType::Semantic,
importance: 5,
category: None,
created_at: Utc::now(),
metadata: Default::default(),
};
let m = scorer.score_multiplier(&meta, "q", 1.0);
assert!((m - 1.0).abs() < f32::EPSILON);
}
}