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
//! A single search result.
use crateVectorId;
use crateMetadata;
/// One result of a similarity search: a matched record and its distance.
///
/// `id` identifies the matched vector, `distance` is its distance from the
/// query under the search's metric (smaller is nearer), and `metadata` is the
/// record's metadata when the engine was asked to return it. Build a bare hit
/// with [`Hit::new`] and attach metadata by setting the field.
///
/// # Examples
///
/// ```
/// use iqdb_types::{Hit, VectorId};
///
/// let hit = Hit::new(VectorId::from(42u64), 0.125);
/// assert_eq!(hit.id, VectorId::U64(42));
/// assert_eq!(hit.distance, 0.125);
/// assert!(hit.metadata.is_none());
/// ```