Skip to content

Commit

Permalink
Fix "Cannot read properties of undefined reading nq" because of the d…
Browse files Browse the repository at this point in the history
…atabase is not passed to `describeCollection` function
  • Loading branch information
rashgaroth committed Nov 11, 2024
1 parent 17d86a7 commit 8315115
Show file tree
Hide file tree
Showing 3 changed files with 4,564 additions and 45 deletions.
15 changes: 12 additions & 3 deletions milvus/grpc/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
f32ArrayToBinaryBytes,
getValidDataArray,
NO_LIMIT,
DescribeCollectionReq,
} from '../';
import { Collection } from './Collection';

Expand Down Expand Up @@ -465,11 +466,19 @@ export class Data extends Collection {
async search(
data: SearchReq | SearchSimpleReq | HybridSearchReq
): Promise<SearchResults> {
// 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(
Expand Down
Loading

0 comments on commit 8315115

Please sign in to comment.