From 6668a8dd4f8cff909fd23f1b16552acd7ef8fd71 Mon Sep 17 00:00:00 2001 From: shanghaikid Date: Thu, 8 Dec 2022 16:50:05 +0800 Subject: [PATCH 1/2] fix binary search case --- test/BinarySearch.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/BinarySearch.spec.ts b/test/BinarySearch.spec.ts index b70b0947..78e500fe 100644 --- a/test/BinarySearch.spec.ts +++ b/test/BinarySearch.spec.ts @@ -20,8 +20,8 @@ describe('Vector search on binary field', () => { collection_name: COLLECTION_NAME, field_name: VECTOR_FIELD_NAME, extra_params: { - index_type: 'IVF_FLAT', - metric_type: 'L2', + index_type: 'BIN_IVF_FLAT', + metric_type: 'TANIMOTO', params: JSON.stringify({ nlist: 1024 }), }, }); @@ -65,13 +65,13 @@ describe('Vector search on binary field', () => { search_params: { anns_field: VECTOR_FIELD_NAME, topk: '4', - metric_type: 'Hamming', + metric_type: 'TANIMOTO', params: JSON.stringify({ nprobe: 1024 }), round_decimal: -1, }, vector_type: DataType.BinaryVector, }); - // console.log('----- Expr Vector Search -----', res); + // console.log('----- Binary Vector Search -----', res); expect(res.status.error_code).toEqual(ErrorCode.SUCCESS); }); }); From ba554c0aa625f31d7936019454090a261b990c0e Mon Sep 17 00:00:00 2001 From: shanghaikid Date: Thu, 8 Dec 2022 18:10:23 +0800 Subject: [PATCH 2/2] update --- test/BinarySearch.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/BinarySearch.spec.ts b/test/BinarySearch.spec.ts index 78e500fe..8d7fb5de 100644 --- a/test/BinarySearch.spec.ts +++ b/test/BinarySearch.spec.ts @@ -60,7 +60,9 @@ describe('Vector search on binary field', () => { const res = await milvusClient.dataManager.search({ collection_name: COLLECTION_NAME, expr: '', - vectors: [[4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3]], + vectors: [ + Array.from({ length: 16 }).map(() => (Math.random() > 0.5 ? 1 : 0)), + ], search_params: { anns_field: VECTOR_FIELD_NAME,