Skip to content

Commit a4e1374

Browse files
committed
removed vector index kind from Kind enum
1 parent 40a043e commit a4e1374

8 files changed

Lines changed: 11 additions & 67 deletions

File tree

internal/request/graphql/schema/collection.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,13 +751,9 @@ func vectorIndexFromAST(
751751
return client.NewIndexRequest{}, ErrIndexWithInvalidArg
752752
}
753753

754-
obj := &ast.ObjectValue{}
755-
if config != nil {
756-
var ok bool
757-
obj, ok = config.(*ast.ObjectValue)
758-
if !ok {
759-
return client.NewIndexRequest{}, ErrIndexWithInvalidArg
760-
}
754+
obj, ok := config.(*ast.ObjectValue)
755+
if !ok {
756+
return client.NewIndexRequest{}, ErrIndexWithInvalidArg
761757
}
762758

763759
var dimensions uint32

internal/request/graphql/schema/index_parse_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,6 @@ func TestParseInvalidIndexOnField(t *testing.T) {
453453
}`,
454454
expectedErr: errIndexInvalidArgument,
455455
},
456-
{
457-
description: "vector kind conflicts with ordered config",
458-
sdl: `type user {
459-
name: String @index(kind: vector, ordered: {})
460-
}`,
461-
expectedErr: errIndexInvalidArgument,
462-
},
463456
{
464457
description: "ordered and vector configs are competing kind selectors",
465458
sdl: `type user {

internal/request/graphql/schema/testfixtures/schema.relatedmany.gen.graphql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,8 +1550,6 @@ input IndexField {
15501550
enum IndexKind {
15511551
"ordered scalar index"
15521552
ordered
1553-
"vector index"
1554-
vector
15551553
}
15561554

15571555
"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. "

internal/request/graphql/schema/testfixtures/schema.relatedone.gen.graphql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,6 @@ input IndexField {
14931493
enum IndexKind {
14941494
"ordered scalar index"
14951495
ordered
1496-
"vector index"
1497-
vector
14981496
}
14991497

15001498
"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. "

internal/request/graphql/schema/testfixtures/schema.simple.gen.graphql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,6 @@ input IndexField {
803803
enum IndexKind {
804804
"ordered scalar index"
805805
ordered
806-
"vector index"
807-
vector
808806
}
809807

810808
"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. "

internal/request/graphql/schema/types/types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ func IndexKindEnum() *gql.Enum {
117117
Description: "ordered scalar index",
118118
Value: OrderedIndexKind,
119119
},
120-
VectorIndexKind: &gql.EnumValueConfig{
121-
Description: "vector index",
122-
Value: VectorIndexKind,
123-
},
124120
},
125121
})
126122
}

internal/request/graphql/schema/vector_index_parse_test.go

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -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

155113
func 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 {

tests/integration/collection_version/vector_index_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestCollectionVersion_VectorIndexOnFloat32ArrayWithoutDimensionsOrEmbedding
6464
&action.AddCollection{
6565
SDL: `
6666
type Users {
67-
embedding: [Float32!] @index(kind: vector)
67+
embedding: [Float32!] @index(vector: {})
6868
}
6969
`,
7070
ExpectedError: "vector index dimensions must be greater than zero",

0 commit comments

Comments
 (0)