matchete/
types.rs

1use {
2    core::fmt::Debug,
3    hashish::HashMap,
4};
5
6/// Represents a match result with score and type information
7#[derive(Debug, Clone)]
8pub struct Product<Q, C> {
9    pub score: f64,
10    pub query: Q,
11    pub candidate: C,
12    pub match_type: MatchType,
13}
14
15/// Type of match found between query and candidate
16#[derive(Debug, PartialEq, Clone)]
17pub enum MatchType {
18    Exact,
19    Similar(String),
20    NotFound,
21}
22
23/// Score details for a single metric
24#[derive(Debug, Clone)]
25pub struct MetricScore {
26    pub id: String,
27    pub raw_score: f64,
28    pub weight: f64,
29    pub weighted_score: f64,
30}
31
32/// Detailed match analysis with all metric scores
33#[derive(Debug, Clone)]
34pub struct DetailedMatchResult<Q, C> {
35    pub query: Q,
36    pub candidate: C,
37    pub score: f64,
38    pub match_type: MatchType,
39    pub metric_scores: Vec<MetricScore>,
40    pub is_match: bool,
41}
42
43/// Configuration for matcher behavior
44#[derive(Debug, Clone)]
45pub struct MatcherConfig {
46    pub threshold: f64,
47    pub options: Option<HashMap<String, String>>,
48}
49
50impl Default for MatcherConfig {
51    fn default() -> Self {
52        Self {
53            threshold: 0.4,
54            options: None,
55        }
56    }
57}