@@ -348,7 +348,7 @@ impl<S: IvfSubIndex + 'static, Q: Quantization + 'static> Index for IVFIndex<S,
348348 ( SubIndexType :: Flat , QuantizationType :: Scalar ) => IndexType :: IvfSq ,
349349 ( SubIndexType :: Hnsw , QuantizationType :: Product ) => IndexType :: IvfHnswPq ,
350350 ( SubIndexType :: Hnsw , QuantizationType :: Scalar ) => IndexType :: IvfHnswSq ,
351- _ => IndexType :: Vector ,
351+ ( SubIndexType :: Hnsw , QuantizationType :: Flat ) => IndexType :: IvfHnswFlat ,
352352 }
353353 }
354354
@@ -1244,6 +1244,26 @@ mod tests {
12441244 test_optimize_strategy ( params) . await ;
12451245 }
12461246
1247+ #[ rstest]
1248+ #[ case( 4 , DistanceType :: L2 , 0.9 ) ]
1249+ #[ case( 4 , DistanceType :: Cosine , 0.9 ) ]
1250+ #[ case( 4 , DistanceType :: Dot , 0.85 ) ]
1251+ #[ tokio:: test]
1252+ async fn test_create_ivf_hnsw_flat (
1253+ #[ case] nlist : usize ,
1254+ #[ case] distance_type : DistanceType ,
1255+ #[ case] recall_requirement : f32 ,
1256+ ) {
1257+ let ivf_params = IvfBuildParams :: new ( nlist) ;
1258+ let hnsw_params = HnswBuildParams :: default ( ) ;
1259+ let params = VectorIndexParams :: ivf_hnsw ( distance_type, ivf_params, hnsw_params) ;
1260+ test_index ( params. clone ( ) , nlist, recall_requirement, None ) . await ;
1261+ if distance_type == DistanceType :: Cosine {
1262+ test_index_multivec ( params. clone ( ) , nlist, recall_requirement) . await ;
1263+ }
1264+ test_optimize_strategy ( params) . await ;
1265+ }
1266+
12471267 #[ rstest]
12481268 #[ case( 4 , DistanceType :: L2 , 0.9 ) ]
12491269 #[ case( 4 , DistanceType :: Cosine , 0.9 ) ]
0 commit comments