@@ -911,6 +911,31 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
911
911
Expect (res .Docs [0 ].Fields ["__v_score" ]).To (BeEquivalentTo ("0" ))
912
912
})
913
913
914
+ It ("should FTCreate VECTOR with dialect 1 " , Label ("search" , "ftcreate" ), func () {
915
+ hnswOptions := & redis.FTHNSWOptions {Type : "FLOAT32" , Dim : 2 , DistanceMetric : "L2" }
916
+ val , err := client .FTCreate (ctx , "idx1" ,
917
+ & redis.FTCreateOptions {},
918
+ & redis.FieldSchema {FieldName : "v" , FieldType : redis .SearchFieldTypeVector , VectorArgs : & redis.FTVectorArgs {HNSWOptions : hnswOptions }}).Result ()
919
+ Expect (err ).NotTo (HaveOccurred ())
920
+ Expect (val ).To (BeEquivalentTo ("OK" ))
921
+ WaitForIndexing (client , "idx1" )
922
+
923
+ client .HSet (ctx , "a" , "v" , "aaaaaaaa" )
924
+ client .HSet (ctx , "b" , "v" , "aaaabaaa" )
925
+ client .HSet (ctx , "c" , "v" , "aaaaabaa" )
926
+
927
+ searchOptions := & redis.FTSearchOptions {
928
+ Return : []redis.FTSearchReturn {{FieldName : "__v_score" }},
929
+ SortBy : []redis.FTSearchSortBy {{FieldName : "__v_score" , Asc : true }},
930
+ DialectVersion : 1 ,
931
+ Params : map [string ]interface {}{"vec" : "aaaaaaaa" },
932
+ }
933
+ res , err := client .FTSearchWithArgs (ctx , "idx1" , "*=>[KNN 2 @v $vec]" , searchOptions ).Result ()
934
+ Expect (err ).NotTo (HaveOccurred ())
935
+ Expect (res .Docs [0 ].ID ).To (BeEquivalentTo ("a" ))
936
+ Expect (res .Docs [0 ].Fields ["__v_score" ]).To (BeEquivalentTo ("0" ))
937
+ })
938
+
914
939
It ("should FTCreate VECTOR with default dialect" , Label ("search" , "ftcreate" ), func () {
915
940
hnswOptions := & redis.FTHNSWOptions {Type : "FLOAT32" , Dim : 2 , DistanceMetric : "L2" }
916
941
val , err := client .FTCreate (ctx , "idx1" ,
0 commit comments