@@ -29,7 +29,7 @@ fn instant_distance_py(_: Python, m: &PyModule) -> PyResult<()> {
29
29
30
30
#[ pyclass]
31
31
struct HnswMap {
32
- inner : instant_distance:: HnswMap < FloatArray , MapValue > ,
32
+ inner : instant_distance:: HnswMap < FloatArray , MapValue , Vec < FloatArray > > ,
33
33
}
34
34
35
35
#[ pymethods]
@@ -54,11 +54,10 @@ impl HnswMap {
54
54
/// Load an index from the given file name
55
55
#[ staticmethod]
56
56
fn load ( fname : & str ) -> PyResult < Self > {
57
- let hnsw_map =
58
- bincode:: deserialize_from :: < _ , instant_distance:: HnswMap < FloatArray , MapValue > > (
59
- BufReader :: with_capacity ( 32 * 1024 * 1024 , File :: open ( fname) ?) ,
60
- )
61
- . map_err ( |e| PyValueError :: new_err ( format ! ( "deserialization error: {e:?}" ) ) ) ?;
57
+ let hnsw_map = bincode:: deserialize_from :: < _ , instant_distance:: HnswMap < _ , _ , _ > > (
58
+ BufReader :: with_capacity ( 32 * 1024 * 1024 , File :: open ( fname) ?) ,
59
+ )
60
+ . map_err ( |e| PyValueError :: new_err ( format ! ( "deserialization error: {e:?}" ) ) ) ?;
62
61
Ok ( Self { inner : hnsw_map } )
63
62
}
64
63
@@ -91,7 +90,7 @@ impl HnswMap {
91
90
/// with a squared Euclidean distance metric.
92
91
#[ pyclass]
93
92
struct Hnsw {
94
- inner : instant_distance:: Hnsw < FloatArray > ,
93
+ inner : instant_distance:: Hnsw < FloatArray , Vec < FloatArray > > ,
95
94
}
96
95
97
96
#[ pymethods]
@@ -112,7 +111,7 @@ impl Hnsw {
112
111
/// Load an index from the given file name
113
112
#[ staticmethod]
114
113
fn load ( fname : & str ) -> PyResult < Self > {
115
- let hnsw = bincode:: deserialize_from :: < _ , instant_distance:: Hnsw < FloatArray > > (
114
+ let hnsw = bincode:: deserialize_from :: < _ , instant_distance:: Hnsw < _ , _ > > (
116
115
BufReader :: with_capacity ( 32 * 1024 * 1024 , File :: open ( fname) ?) ,
117
116
)
118
117
. map_err ( |e| PyValueError :: new_err ( format ! ( "deserialization error: {e:?}" ) ) ) ?;
@@ -145,7 +144,7 @@ impl Hnsw {
145
144
/// Search buffer and result set
146
145
#[ pyclass]
147
146
struct Search {
148
- inner : instant_distance:: Search ,
147
+ inner : instant_distance:: Search < FloatArray > ,
149
148
cur : Option < ( HnswType , usize ) > ,
150
149
}
151
150
0 commit comments