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(