Skip to content
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

add 2.4 index #272

Merged
merged 4 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions milvus/const/milvus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,15 @@ export enum IndexType {
GPU_IVF_FLAT = 'GPU_IVF_FLAT',
GPU_IVF_PQ = 'GPU_IVF_PQ',
GPU_IVF_SQ8 = 'GPU_IVF_SQ8',
GPU_BRUTE_FORCE = 'GPU_BRUTE_FORCE',
GPU_CAGRA = 'GPU_CAGRA',
RAFT_IVF_FLAT = 'RAFT_IVF_FLAT',
RAFT_IVF_PQ = 'RAFT_IVF_PQ',
ScaNN = 'SCANN',
// scalar
STL_SORT = 'STL_SORT',
TRIE = 'Trie',
INVERTED = 'INVERTED',
}

// MsgType
Expand Down
52 changes: 43 additions & 9 deletions test/grpc/Index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ describe(`Milvus Index API`, () => {
expect(res.error_code).toEqual(ErrorCode.SUCCESS);
});

it(`Create STL_SORT index on int64 should success`, async () => {
const res = await milvusClient.createIndex({
index_name: 'int64_index',
collection_name: COLLECTION_NAME,
field_name: 'int64',
index_type: IndexType.STL_SORT,
});
expect(res.error_code).toEqual(ErrorCode.SUCCESS);
});

it(`Create TRIE index on int64 varchar success`, async () => {
const res = await milvusClient.createIndex({
index_name: 'varchar_index',
collection_name: COLLECTION_NAME,
field_name: 'varChar',
index_type: IndexType.TRIE,
});
expect(res.error_code).toEqual(ErrorCode.SUCCESS);
});

it(`Create INVERTED index on int64 varchar success`, async () => {
const res = await milvusClient.createIndex({
index_name: 'float_index',
collection_name: COLLECTION_NAME,
field_name: 'float',
index_type: IndexType.INVERTED,
});
expect(res.error_code).toEqual(ErrorCode.SUCCESS);
});

it(`Create Index without name should success`, async () => {
const res = await milvusClient.createIndex({
collection_name: COLLECTION_NAME_WITHOUT_INDEX_NAME,
Expand Down Expand Up @@ -230,7 +260,8 @@ describe(`Milvus Index API`, () => {
collection_name: COLLECTION_NAME,
index_name: INDEX_NAME,
});
expect(res.index_descriptions[0].index_name).toEqual(INDEX_NAME);
const allIndexNames = res.index_descriptions.map(i => i.index_name);
expect(allIndexNames.includes(INDEX_NAME)).toEqual(true);
expect(res.status.error_code).toEqual(ErrorCode.SUCCESS);
});

Expand All @@ -240,7 +271,9 @@ describe(`Milvus Index API`, () => {
field_name: VECTOR_FIELD_NAME,
});

expect(res.index_descriptions[0].field_name).toEqual(VECTOR_FIELD_NAME);
const field_names = res.index_descriptions.map(i => i.field_name);
expect(field_names.includes(VECTOR_FIELD_NAME)).toEqual(true);

expect(res.status.error_code).toEqual(ErrorCode.SUCCESS);
});

Expand Down Expand Up @@ -283,13 +316,14 @@ describe(`Milvus Index API`, () => {
expect(res.status.error_code).toEqual(ErrorCode.SUCCESS);
});

it(`Get Index progress with field name should be failed`, async () => {
const res = await milvusClient.getIndexBuildProgress({
collection_name: COLLECTION_NAME,
field_name: VECTOR_FIELD_NAME,
});
expect(res.status.error_code).toEqual(ErrorCode.SUCCESS);
});
// @Deprecated
// it(`Get Index progress with field name should be failed`, async () => {
// const res = await milvusClient.getIndexBuildProgress({
// collection_name: COLLECTION_NAME,
// field_name: VECTOR_FIELD_NAME,
// });
// expect(res.status.error_code).toEqual(ErrorCode.SUCCESS);
// });

it(`Drop Index with index name`, async () => {
const res = await milvusClient.dropIndex({
Expand Down