diff --git a/example/HelloMilvus.ts b/example/HelloMilvus.ts index 8261aab3..aa239c30 100644 --- a/example/HelloMilvus.ts +++ b/example/HelloMilvus.ts @@ -3,7 +3,7 @@ import { DataType } from "@zilliz/milvus2-sdk-node/dist/milvus/types/Common"; import { InsertReq } from "@zilliz/milvus2-sdk-node/dist/milvus/types/Data"; const milvusClient = new MilvusClient("localhost:19530"); -const collectionManager = milvusClient.collectionManager; +const collectionManager = MilvusClient.collectionManager; console.log("Milvus SDK Info: ", milvusClient.sdkInfo); diff --git a/milvus/Client.ts b/milvus/Client.ts index 8b0930aa..b8c6fc50 100644 --- a/milvus/Client.ts +++ b/milvus/Client.ts @@ -7,12 +7,17 @@ export class Client { this.client = client; } + /** + * @ignore + */ checkCollectionName(data: any) { if (!data || !data.collection_name) { throw new Error(ERROR_REASONS.COLLECTION_NAME_IS_REQUIRED); } } - + /** + * @ignore + */ checkCollectionAndPartitionName(data: any) { if (!data || !data.collection_name || !data.partition_name) { throw new Error(ERROR_REASONS.COLLECTION_PARTITION_NAME_ARE_REQUIRED); diff --git a/milvus/Data.ts b/milvus/Data.ts index 00569653..6541957d 100644 --- a/milvus/Data.ts +++ b/milvus/Data.ts @@ -4,7 +4,7 @@ import { Client } from "./Client"; import { Collection } from "./Collection"; import { ERROR_REASONS } from "./const/ErrorReason"; -import { DataType, DataTypeMap, DslType, SegmentState } from "./types/Common"; +import { DataType, DataTypeMap, DslType } from "./types/Common"; import { CalcDistanceReq, DeleteEntitiesReq, diff --git a/milvus/index.ts b/milvus/index.ts index e026d1a0..99c32f9d 100644 --- a/milvus/index.ts +++ b/milvus/index.ts @@ -50,7 +50,7 @@ export class MilvusClient { this.dataManager = new Data(this.client, this.collectionManager); } - get sdkInfo() { + static get sdkInfo() { return { version: sdkInfo.version, recommandMilvus: sdkInfo.milvusVersion, @@ -69,10 +69,10 @@ export class MilvusClient { // Each node contains the same system info, so get version from first one. const curMilvusVersion = res.response.nodes_info[0]?.infos?.system_info?.build_version; - if (curMilvusVersion !== this.sdkInfo.recommandMilvus) { + if (curMilvusVersion !== MilvusClient.sdkInfo.recommandMilvus) { console.warn("------- Warning ---------"); console.warn( - `Node sdk ${this.sdkInfo.version} recommend Milvus Version ${this.sdkInfo.recommandMilvus}.\nDifferent version may cause some error.` + `Node sdk ${MilvusClient.sdkInfo.version} recommend Milvus Version ${MilvusClient.sdkInfo.recommandMilvus}.\nDifferent version may cause some error.` ); return { error_code: ErrorCode.SUCCESS, match: false }; } diff --git a/test/Index.spec.ts b/test/Index.spec.ts index aa9f19a1..f65f06f9 100644 --- a/test/Index.spec.ts +++ b/test/Index.spec.ts @@ -1,7 +1,6 @@ import { MilvusClient } from "../milvus"; import { GENERATE_NAME, IP } from "../const"; -import { DataType } from "../milvus/types/Common"; import { ErrorCode } from "../milvus/types/Response"; import { genCollectionParams, VECTOR_FIELD_NAME } from "../utils/test"; import { ERROR_REASONS } from "../milvus/const/ErrorReason"; diff --git a/test/MilvusClient.spec.ts b/test/MilvusClient.spec.ts index 7a42f43a..4bae450b 100644 --- a/test/MilvusClient.spec.ts +++ b/test/MilvusClient.spec.ts @@ -16,8 +16,8 @@ describe("Milvus client ", () => { }); it("Expect get node sdk info", async () => { - expect(milvusClient.sdkInfo.version).toEqual(sdkInfo.version); - expect(milvusClient.sdkInfo.recommandMilvus).toEqual(sdkInfo.milvusVersion); + expect(MilvusClient.sdkInfo.version).toEqual(sdkInfo.version); + expect(MilvusClient.sdkInfo.recommandMilvus).toEqual(sdkInfo.milvusVersion); }); it("Check version should success", async () => {