File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ mod tests {
233233 let temp_dir = tempdir ( ) . unwrap ( ) ;
234234 let config = DbConfig {
235235 storage_type : StorageType :: RocksDb ,
236- index_type : IndexType :: HNSW ,
236+ index_type : IndexType :: Flat ,
237237 data_path : temp_dir. path ( ) . to_path_buf ( ) ,
238238 dimension : 3 ,
239239 similarity : Similarity :: Cosine ,
@@ -359,7 +359,7 @@ mod tests {
359359
360360 // Search with limit 3
361361 let query = vec ! [ 0.0 , 0.0 , 0.0 ] ;
362- let results = db. search ( query, Similarity :: Cosine , 3 ) . unwrap ( ) ;
362+ let results = db. search ( query, Similarity :: Euclidean , 3 ) . unwrap ( ) ;
363363
364364 assert_eq ! ( results. len( ) , 3 ) ;
365365 }
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ use crate::{
1212 } ,
1313} ;
1414
15- #[ repr( packed) ]
1615#[ derive( Serialize , Deserialize ) ]
1716pub struct HnswMetadataPack {
1817 pub ef_construction : usize ,
@@ -51,7 +50,7 @@ impl SerializableIndex for HnswIndex {
5150 . map_err ( |e| DbError :: SerializationError ( e. to_string ( ) ) ) ?;
5251 buffer. extend ( index_bytes) ;
5352
54- return Ok ( buffer) ;
53+ Ok ( buffer)
5554 }
5655
5756 fn serialize_metadata ( & self ) -> Result < Vec < u8 > , DbError > {
@@ -66,7 +65,7 @@ impl SerializableIndex for HnswIndex {
6665 let metadata_bytes = bincode:: serialize ( & index_pack)
6766 . map_err ( |e| DbError :: SerializationError ( e. to_string ( ) ) ) ?;
6867 buffer. extend ( metadata_bytes) ;
69- return Ok ( buffer) ;
68+ Ok ( buffer)
7069 }
7170
7271 fn snapshot ( & self ) -> Result < IndexSnapshot , DbError > {
Original file line number Diff line number Diff line change @@ -283,7 +283,6 @@ impl Snapshot {
283283 IndexType :: Flat => Arc :: new ( RwLock :: new ( FlatIndex :: deserialize ( & index_snapshot) ?) ) ,
284284 IndexType :: KDTree => Arc :: new ( RwLock :: new ( KDTree :: deserialize ( & index_snapshot) ?) ) ,
285285 IndexType :: HNSW => Arc :: new ( RwLock :: new ( HnswIndex :: deserialize ( & index_snapshot) ?) ) ,
286- _ => return Err ( DbError :: SnapshotError ( "Unsupported index type" . to_string ( ) ) ) ,
287286 } ;
288287
289288 vector_index
You can’t perform that action at this time.
0 commit comments