@@ -1419,13 +1419,13 @@ impl SegmentConfig {
14191419 payload_storage_type : _,
14201420 } = self ;
14211421
1422- let is_vector_config_compatible = is_compatible (
1422+ let is_vector_config_compatible = is_map_compatible (
14231423 & self . vector_data ,
14241424 & other. vector_data ,
14251425 VectorDataConfig :: is_compatible,
14261426 ) ;
14271427
1428- let is_sparse_vector_config_compatible = is_compatible (
1428+ let is_sparse_vector_config_compatible = is_map_compatible (
14291429 & self . sparse_vector_data ,
14301430 & other. sparse_vector_data ,
14311431 SparseVectorDataConfig :: is_compatible,
@@ -1435,7 +1435,7 @@ impl SegmentConfig {
14351435 }
14361436}
14371437
1438- fn is_compatible < V , C , F > ( this : & HashMap < V , C > , other : & HashMap < V , C > , check : F ) -> bool
1438+ fn is_map_compatible < V , C , F > ( this : & HashMap < V , C > , other : & HashMap < V , C > , check : F ) -> bool
14391439where
14401440 V : Eq + Hash ,
14411441 F : Fn ( & C , & C ) -> bool ,
@@ -1518,6 +1518,17 @@ pub struct MultiVectorConfig {
15181518 pub comparator : MultiVectorComparator ,
15191519}
15201520
1521+ impl MultiVectorConfig {
1522+ fn is_compatible ( & self , other : & Self ) -> bool {
1523+ // TODO: Does comparator have to be same for two segments to be compatible? 🤔
1524+
1525+ // Assert multi-vector config fields
1526+ let Self { comparator : _ } = self ;
1527+
1528+ self . comparator == other. comparator // TODO: 🤔
1529+ }
1530+ }
1531+
15211532#[ derive(
15221533 Debug , Default , Deserialize , Serialize , JsonSchema , Anonymize , Eq , PartialEq , Copy , Clone , Hash ,
15231534) ]
@@ -1596,8 +1607,19 @@ impl VectorDataConfig {
15961607
15971608 self . size == other. size
15981609 && self . distance == other. distance
1599- && self . multivector_config == other. multivector_config // TODO: 🤔
16001610 && self . datatype == other. datatype // TODO: 🤔
1611+ && is_opt_compatible (
1612+ self . multivector_config . as_ref ( ) ,
1613+ other. multivector_config . as_ref ( ) ,
1614+ MultiVectorConfig :: is_compatible,
1615+ )
1616+ }
1617+ }
1618+
1619+ fn is_opt_compatible < T , F : Fn ( T , T ) -> bool > ( this : Option < T > , other : Option < T > , check : F ) -> bool {
1620+ match ( this, other) {
1621+ ( Some ( this) , Some ( other) ) => check ( this, other) ,
1622+ _ => false ,
16011623 }
16021624}
16031625
0 commit comments