@@ -650,7 +650,7 @@ impl IndexDef {
650650 fn from_vector_index_def (
651651 index_def : & spec:: VectorIndexDef ,
652652 field_typ : & schema:: ValueType ,
653- method : Option < spec:: VectorIndexMethod > ,
653+ _method : Option < spec:: VectorIndexMethod > ,
654654 ) -> Result < Self > {
655655 let method = index_def. method . clone ( ) ;
656656 if let Some ( spec:: VectorIndexMethod :: IvfFlat { .. } ) = method {
@@ -764,33 +764,30 @@ impl components::SetupOperator for SetupComponentOperator {
764764 vector_size,
765765 method,
766766 } => {
767- let method_config =
768- if let Some ( spec:: VectorIndexMethod :: Hnsw { m, ef_construction } ) = method {
769- let mut parts = vec ! [ ] ;
770- if let Some ( m_val) = m {
771- parts. push ( format ! ( "`hnsw.m`: {}" , m_val) ) ;
772- }
773- if let Some ( ef_val) = ef_construction {
774- parts. push ( format ! ( "`hnsw.ef_construction`: {}" , ef_val) ) ;
775- }
776- if parts. is_empty ( ) {
777- "" . to_string ( )
778- } else {
779- format ! ( ", {}" , parts. join( ", " ) )
780- }
781- } else {
782- "" . to_string ( )
783- } ;
767+ let mut parts = vec ! [ ] ;
768+
769+ parts. push ( format ! ( "`vector.dimensions`: {}" , vector_size) ) ;
770+ parts. push ( format ! ( "`vector.similarity_function`: '{}'" , metric) ) ;
771+
772+ if let Some ( spec:: VectorIndexMethod :: Hnsw { m, ef_construction } ) = method {
773+ if let Some ( m_val) = m {
774+ parts. push ( format ! ( "`vector.hnsw.m`: {}" , m_val) ) ;
775+ }
776+ if let Some ( ef_val) = ef_construction {
777+ parts. push ( format ! ( "`vector.hnsw.ef_construction`: {}" , ef_val) ) ;
778+ }
779+ }
780+
784781 formatdoc ! { "
785782 CREATE VECTOR INDEX {name} IF NOT EXISTS
786783 FOR {matcher} ON {qualifier}.{field_name}
787784 OPTIONS {{
788785 indexConfig: {{
789- `vector.dimensions`: {vector_size},
790- `vector.similarity_function`: '{metric}'{method_config}
786+ {config}
791787 }}
792788 }}" ,
793789 name = key. name,
790+ config = parts. join( ", " )
794791 }
795792 }
796793 } ) ;
0 commit comments