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
use Duration;
/// A single match returned by a query.
/// A ring query: find all vectors whose Euclidean distance to `query`
/// lies within `[d - lambda, d + lambda]`.
///
/// Internally, ringdb uses squared L2 distances to avoid computing square
/// roots. The ring bounds become:
///
/// ```text
/// lower_sq = max(0, d - lambda)²
/// upper_sq = (d + lambda)²
/// ```
/// A range query: find all vectors whose Euclidean distance to `query`
/// lies within `[d_min, d_max]`.
/// A disk query: find all vectors whose Euclidean distance to `query`
/// is at most `d_max` (i.e. the full disk/ball of radius `d_max`).
///
/// This is equivalent to a [`RangeQuery`] with `d_min = 0`.
/// A disk-intersection query: find all vectors inside every disk.
///
/// Each disk is a [`DiskQuery`] containing a center vector and an inclusive
/// radius. The query must contain at least one disk. Returned [`Hit::dist_sq`]
/// values are measured against the first disk's query vector.
/// Result of a ring/range/disk query.