-
Notifications
You must be signed in to change notification settings - Fork 32
1.37/support drop vector index #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/1.37
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1085,6 +1085,76 @@ describe('Testing of the collection.config namespace', () => { | |
| }); | ||
| }); | ||
|
|
||
| requireAtLeast(1, 37, 0).describe('dropVectorIndex', () => { | ||
| it('should drop default vector index from a collection', async () => { | ||
| const collectionName = 'TestDropDefaultVectorIndex'; | ||
| const collection = await client.collections.create({ | ||
| name: collectionName, | ||
| vectorizers: weaviate.configure.vectors.selfProvided({ | ||
| vectorIndexConfig: weaviate.configure.vectorIndex.hnsw(), | ||
| }), | ||
| }); | ||
|
|
||
| let config = await collection.config.get(); | ||
| expect(config.vectorizers.default.indexType).toEqual('hnsw'); | ||
|
|
||
| await collection.config.dropVectorIndex(); | ||
|
|
||
| config = await collection.config.get(); | ||
| expect(config.vectorizers.default.indexType).toEqual('none'); | ||
| }); | ||
|
|
||
| it('should throw an error when trying to drop a non-existent named vector index', async () => { | ||
| const collectionName = 'TestDropNonExistentNamedVectorIndex'; | ||
| const collection = await client.collections.create({ | ||
| name: collectionName, | ||
| vectorizers: weaviate.configure.vectors.selfProvided({ | ||
| name: 'existing', | ||
| vectorIndexConfig: weaviate.configure.vectorIndex.hnsw(), | ||
| }), | ||
| }); | ||
|
|
||
| await expect(collection.config.dropVectorIndex('nonexistent')).rejects.toThrow( | ||
| 'The request to Weaviate failed with status code: 422 and message: {"error":[{"message":"not found: vector index \\"nonexistent\\" not found in class \\"TestDropNonExistentNamedVectorIndex\\""}]}' | ||
|
Comment on lines
+1117
to
+1118
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the client generally throws errors on the 200+ HTTP codes? If yes, then it seems like this test is redundant, it essentially tests the server's response to a non-existen input. If no, then let's not assert the contents of the message -- someone may re-phrase that in v1.38 or sth and fail the client pipeline (used to happen a lot in the Java client test suite) |
||
| ); | ||
|
|
||
| // Ensure existing vector index is still intact | ||
| const config = await collection.config.get(); | ||
| expect(config.vectorizers.existing.indexType).toEqual('hnsw'); | ||
| }); | ||
|
|
||
| it('should drop named vector index from a collection with generics', async () => { | ||
| type TestDropVectorIndexVectors = { | ||
| one: number[]; | ||
| two: number[]; | ||
| }; | ||
| const collectionName = 'TestDropNamedVectorIndex'; | ||
| const collection = await client.collections.create<any, string, TestDropVectorIndexVectors>({ | ||
| name: collectionName, | ||
| vectorizers: [ | ||
| weaviate.configure.vectors.selfProvided({ | ||
| name: 'one', | ||
| vectorIndexConfig: weaviate.configure.vectorIndex.hnsw(), | ||
| }), | ||
| weaviate.configure.vectors.selfProvided({ | ||
| name: 'two', | ||
| vectorIndexConfig: weaviate.configure.vectorIndex.hnsw(), | ||
| }), | ||
| ], | ||
| }); | ||
|
|
||
| let config = await collection.config.get(); | ||
| expect(config.vectorizers.one.indexType).toEqual('hnsw'); | ||
| expect(config.vectorizers.two.indexType).toEqual('hnsw'); | ||
|
|
||
| await collection.config.dropVectorIndex('one'); | ||
|
|
||
| config = await collection.config.get(); | ||
| expect(config.vectorizers.one.indexType).toEqual('none'); | ||
| expect(config.vectorizers.two.indexType).toEqual('hnsw'); | ||
| }); | ||
| }); | ||
|
|
||
| requireAtLeast(1, 35, 0).it('should create and update Object TTL configuration', async () => { | ||
| const collectionName = 'TestObjectTTL'; | ||
| const collection = await client.collections.create({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a nit, but I think it's good to be specific about the fact that Weaviate doesn't have the notion of a default vector index, and it's the client that will fallback to
"default"input. E.g. if the user's only index is called "my-only-index" they should expect to see an error ondropVectorIndex(undefined).I would argue this parameter should be required tho, similarly to how when you're trying to delete a GH repo you need to manually enter the repo's name to confirm. Not insisting on it tho, just my first response to
vectorName?.