|
@@ -183,11 +183,24 @@ public class CollectionService extends BaseService {
|
|
|
ShowCollectionsRequest showCollectionsRequest = ShowCollectionsRequest.newBuilder()
|
|
|
.build();
|
|
|
ShowCollectionsResponse response = blockingStub.showCollections(showCollectionsRequest);
|
|
|
- ListCollectionsResp listCollectionsResp = ListCollectionsResp.builder()
|
|
|
+
|
|
|
+ List<CollectionInfo> collectionInfos = new ArrayList<>();
|
|
|
+ for (int i = 0; i < response.getCollectionNamesCount(); i++) {
|
|
|
+ CollectionInfo collectionInfo = CollectionInfo.builder()
|
|
|
+ .collectionName(response.getCollectionNames(i))
|
|
|
+ .build();
|
|
|
+ // Milvus version >= 2.6.1 will additionally return shardNum
|
|
|
+ List<Integer> shardsNums = response.getShardsNumList();
|
|
|
+ if (CollectionUtils.isNotEmpty(shardsNums)) {
|
|
|
+ collectionInfo.setShardNum(response.getShardsNum(i));
|
|
|
+ }
|
|
|
+ collectionInfos.add(collectionInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ListCollectionsResp.builder()
|
|
|
.collectionNames(response.getCollectionNamesList())
|
|
|
+ .collectionInfos(collectionInfos)
|
|
|
.build();
|
|
|
-
|
|
|
- return listCollectionsResp;
|
|
|
}
|
|
|
|
|
|
public Void dropCollection(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, DropCollectionReq request) {
|