From d005aaff2dd544777d2ad75387c79c8ebbda8813 Mon Sep 17 00:00:00 2001 From: Rashgaroth <50513263+rashgaroth@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:49:44 +0800 Subject: [PATCH] Passing `db_name` param to the `describeCollection()` (#373) * Fix "Cannot read properties of undefined reading nq" because of the database is not passed to `describeCollection` function * Delete package-lock.json * Delete yarn.lock * Revert "Delete yarn.lock" This reverts commit 9c4d8e5d121e9f9441de7bc3821bb5a747ccb0a6. * Remove lock files This reverts commit 8315115f9a6981a615e46fcbda840879726e681e. * Revert "Remove lock files" This reverts commit 4f2377552411f47acc7908621c37909d9a4ac64e. * Remove lock files --- milvus/grpc/Data.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/milvus/grpc/Data.ts b/milvus/grpc/Data.ts index 98aee2e3..addd82a0 100644 --- a/milvus/grpc/Data.ts +++ b/milvus/grpc/Data.ts @@ -67,6 +67,7 @@ import { f32ArrayToBinaryBytes, getValidDataArray, NO_LIMIT, + DescribeCollectionReq, } from '../'; import { Collection } from './Collection'; @@ -465,11 +466,19 @@ export class Data extends Collection { async search( data: SearchReq | SearchSimpleReq | HybridSearchReq ): Promise { - // get collection info - const collectionInfo = await this.describeCollection({ + // default collection request + const describeCollectionRequest = { collection_name: data.collection_name, cache: true, - }); + } as DescribeCollectionReq; + + // get collection info + if (data.db_name) { + // if the request has `db_name` pass it to the request. + describeCollectionRequest.db_name = data.db_name; + } + + const collectionInfo = await this.describeCollection(describeCollectionRequest); // build search params const { request, nq, round_decimal, isHybridSearch } = buildSearchRequest(