From 69a2e9d420d89fac03cdfbfd5a9535ae65d9a4d0 Mon Sep 17 00:00:00 2001 From: ryjiang Date: Mon, 18 Nov 2024 15:32:28 +0800 Subject: [PATCH] [2.5] support bitmap index (#376) * add bitmap index Signed-off-by: ryjiang * update test build Signed-off-by: ryjiang * disable debug --------- Signed-off-by: ryjiang --- milvus/const/milvus.ts | 2 ++ milvus/types/Common.ts | 5 ++++- test/grpc/Index.spec.ts | 12 +++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/milvus/const/milvus.ts b/milvus/const/milvus.ts index 977101ef..f0b73aca 100644 --- a/milvus/const/milvus.ts +++ b/milvus/const/milvus.ts @@ -150,6 +150,8 @@ export enum IndexType { STL_SORT = 'STL_SORT', TRIE = 'Trie', INVERTED = 'INVERTED', + // 2.5 + BITMAP = 'BITMAP', } // MsgType diff --git a/milvus/types/Common.ts b/milvus/types/Common.ts index 05f8a7db..08b839c8 100644 --- a/milvus/types/Common.ts +++ b/milvus/types/Common.ts @@ -58,7 +58,10 @@ export interface TimeStampArray { created_utc_timestamps: string[]; } -export type keyValueObj = Record; +export type keyValueObj = Record< + string, + string | number | string[] | number[] | boolean +>; export interface collectionNameReq extends GrpcTimeOut { collection_name: string; // required, collection name diff --git a/test/grpc/Index.spec.ts b/test/grpc/Index.spec.ts index 83e0e593..c420ba8b 100644 --- a/test/grpc/Index.spec.ts +++ b/test/grpc/Index.spec.ts @@ -14,7 +14,7 @@ import { } from '../tools'; import { timeoutTest } from '../tools'; -const milvusClient = new MilvusClient({ address: IP }); +const milvusClient = new MilvusClient({ address: IP, logLevel: 'info' }); // names const COLLECTION_NAME = GENERATE_NAME(); const COLLECTION_NAME_WITHOUT_INDEX_NAME = GENERATE_NAME(); @@ -271,6 +271,16 @@ describe(`Milvus Index API`, () => { expect(res.error_code).toEqual(ErrorCode.SUCCESS); }); + it(`Create Bitmap index on int32_array array should success`, async () => { + const res = await milvusClient.createIndex({ + index_name: 'bitmap_index', + collection_name: COLLECTION_NAME, + field_name: 'int32_array', + index_type: IndexType.BITMAP, + }); + 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,