1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! [`FusedScore`] — the framework's OWN currency, and the only score in the system nobody's engine
//! minted.
/// What a fused retrieve ranks by: the sum of its members' reciprocal-rank contributions.
///
/// # It compares WITHIN ONE RESULT and nowhere else
///
/// The number is a function of how many members ranked this root and how highly, so it is
/// meaningful against the other roots of the SAME answer and against nothing else. Two things it is
/// specifically not:
///
/// - **Not comparable across queries.** A query that three members answered produces larger numbers
/// than one that two answered, with no statement about relevance in the difference.
/// - **Not a confidence.** It has no interpretation as a probability or a similarity, and it is
/// deliberately NOT a [`Score`](crate::Score): that type IS the closed unit interval, and writing
/// it here would be a claim that something normalised this value, which nothing did.
///
/// A client sorting by it, thresholding it against a constant, or storing it to compare with
/// tomorrow's is doing three things, and only the first is defined.
///
/// # `f64`, and the framework's rather than the engines'
///
/// The members' own currencies never enter — an engine's [`Score`](crate::FulltextEngine::Score) is
/// untranslated all the way to the evidence, and the fold reads its ORDINAL instead. So the width
/// here is chosen for the arithmetic and not to match anybody: a sum of up to N terms each in
/// `(0, 1]`, where the terms differ by factors of thousands once a member's ordinals run deep, and
/// `f32` loses the small ones under the large ones exactly where the fold is deciding a close call.
///
/// # The total order, and the one value the constructor refuses
///
/// `NaN` is the only `f64` for which `partial_cmp` answers `None`, and refusing it at construction
/// is what makes [`Ord`] a fact about this type rather than a convention its users keep. That is
/// [`Score`](crate::Score)'s own move, made here for the same reason and at a different range: this
/// type has NO range to check, an unbounded sum being what it is, so the refusal is `NaN` alone.
///
/// The infinities are ADMITTED, which is the honest reading rather than an oversight: they order
/// totally against everything else, and refusing them would put a fallible constructor in the
/// middle of a fold whose inputs cannot produce one anyway — `1 / (k + rank)` with a rank of at
/// least one is finite by construction.
;
// `PartialEq` is derived and `Eq` is not, because only one of the two is a statement about `f64`:
// its equality is already the right one here, and its REFLEXIVITY is a property of THIS type — `x ==
// x` fails for `NaN` alone, and a fused score is never one.