@@ -71,48 +71,6 @@ func TestParseVectorIndex_OnField_ParsesArgsAndDefaults(t *testing.T) {
7171 },
7272 },
7373 },
74- {
75- description : "vector kind uses vector and HNSW defaults" ,
76- sdl : `type user {
77- embedding: [Float32!] @index(kind: vector)
78- }` ,
79- targetDescriptions : []client.NewIndexRequest {
80- {
81- Fields : []client.IndexedFieldDescription {
82- {Name : "embedding" },
83- },
84- Vector : & client.VectorIndexDescription {
85- Algorithm : client .VectorAlgorithmHNSW ,
86- Metric : client .DistanceMetricCosine ,
87- HNSW : & client.HNSWParams {
88- M : 16 ,
89- EfConstruction : 128 ,
90- EfSearch : 64 ,
91- },
92- },
93- },
94- },
95- },
96- {
97- description : "matching kind and vector config are allowed" ,
98- sdl : `type user {
99- embedding: [Float32!] @index(kind: vector, vector: {})
100- }` ,
101- targetDescriptions : []client.NewIndexRequest {
102- {
103- Fields : []client.IndexedFieldDescription {{Name : "embedding" }},
104- Vector : & client.VectorIndexDescription {
105- Algorithm : client .VectorAlgorithmHNSW ,
106- Metric : client .DistanceMetricCosine ,
107- HNSW : & client.HNSWParams {
108- M : 16 ,
109- EfConstruction : 128 ,
110- EfSearch : 64 ,
111- },
112- },
113- },
114- },
115- },
11674 }
11775
11876 for _ , test := range cases {
@@ -154,6 +112,13 @@ func TestParseVectorIndex_OnField_ProducesVectorKindIndex(t *testing.T) {
154112
155113func TestParseVectorIndex_InvalidArgs_ReturnsError (t * testing.T ) {
156114 cases := []invalidIndexTestCase {
115+ {
116+ description : "vector is not an index kind" ,
117+ sdl : `type user {
118+ embedding: [Float32!] @index(kind: vector)
119+ }` ,
120+ expectedErr : `Expected type "IndexKind", found vector` ,
121+ },
157122 {
158123 description : "unknown algorithm enum" ,
159124 sdl : `type user {
0 commit comments